tx · 6bPHhC8KvqeM2bti86ee4R6bzFWK7LKk3Ayig3YZgo8y 3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP: -0.01400000 Waves 2019.11.14 18:51 [764935] smart account 3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP > SELF 0.00000000 Waves
{ "type": 13, "id": "6bPHhC8KvqeM2bti86ee4R6bzFWK7LKk3Ayig3YZgo8y", "fee": 1400000, "feeAssetId": null, "timestamp": 1573746426424, "version": 1, "sender": "3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP", "senderPublicKey": "3bmZaUZ9wp3K1YZQFqTkN1oZzumQPi7WLQ9QowMaqqEZ", "proofs": [ "eMN5BjqF2HYRak3vZmx4fYEqcUPdyhZn9jx7DqFzrqce89xpxsCN4oyAQD6s3RJxqETZX96B1ZLWvskyJKs3Dnz" ], "script": "base64:AAIDAAAAAAAAAAsIARIDCgEIEgASAAAAAAQAAAAAE2xvdHRlcnlUaWNrZXRIb2xkZXIJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQY85hy7YeAyDRGFObJCypdEQTLdt733vIAAAAADGxvdHRlcnlPd25lcgIAAAAjM014dHpuY0tNOXgxa0twTFAzc3A4V1pQdmcxY3phOGpIR20AAAAAC293bmVyUHViS2V5AQAAACCmNNugTM3YDCyk7xZ6vz/eGflRJPu15vOIW0V7gpcRMAAAAAARZEFwcFJhbmRvbUFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQs+qsE+m8UScrki/mi9Vg1BPLz1NtSCiEAAAADAAAACmNvbnRleHRPYmoBAAAAF3JhbmRvbVJlcXVlc3RUeElkUmVjb3JkAAAAAQAAABFyYW5kb21SZXF1ZXN0VHhJZAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMCAAAAEXJhbmRvbVJlcXVlc3RUeElkCQAAAgAAAAECAAAAInJhbmRvbUlkVHggaXMgYWxyZWFkeSBpbiB0aGUgc3RhdGUDCQ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AACBQAAAAckbWF0Y2gwAgAAABBMZWFzZVRyYW5zYWN0aW9uBAAAAAFsBQAAAAckbWF0Y2gwAwMDCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAGYAAAACBQAAAA5oZWlnaHRFbmRMZWFzZQUAAAAGaGVpZ2h0BwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwIAAAANd2lubmVyQWRkcmVzcwcJAAAAAAAAAggFAAAAAWwAAAAJcmVjaXBpZW50CQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAA13aW5uZXJBZGRyZXNzBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAWTGVhc2VDYW5jZWxUcmFuc2FjdGlvbgQAAAACbGMFAAAAByRtYXRjaDADCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5BwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAABBoZWlnaHRTdGFydExlYXNlCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALb3duZXJQdWJLZXkHBjMLcbo=", "chainId": 84, "height": 764935, "spentComplexity": 0 } View: original | compacted Prev: 3mjXY3uUg2Jrpk9YpHbJF2V7yBJTP1UhnRfboDRPQj6P Next: 2as9TnjHo2pu1BxK6VttkgSZq1uSKQXimx9HV1SumSDp 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 = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP') | |
5 | 5 | ||
6 | - | let b = " | |
6 | + | let b = "3MxtzncKM9x1kKpLP3sp8WZPvg1cza8jHGm" | |
7 | 7 | ||
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") | |
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") | |
24 | 30 | } | |
25 | 31 | ||
26 | 32 | ||
27 | 33 | ||
28 | - | @Callable( | |
29 | - | func | |
30 | - | let j = | |
31 | - | if (isDefined( | |
34 | + | @Callable(e) | |
35 | + | func defineTheWinner () = { | |
36 | + | let j = getIntegerValue(this, "randomResult") | |
37 | + | if (isDefined(getInteger(a, ("winningTicket" + toString(j))))) | |
32 | 38 | then { | |
33 | - | let k = getString(j, "winner") | |
34 | - | WriteSet([DataEntry("winningTicket", i)]) | |
39 | + | let k = getIntegerValue(a, "ticketAmount") | |
40 | + | let l = if ((j == k)) | |
41 | + | then 1 | |
42 | + | else (j + 1) | |
43 | + | WriteSet([DataEntry("randomResult", l)]) | |
35 | 44 | } | |
36 | - | else throw("you touch incorrect lottery address") | |
45 | + | else { | |
46 | + | let m = getStringValue(a, ("ticket" + toString(j))) | |
47 | + | WriteSet([DataEntry("winnerTicket", j), DataEntry("winnerAddress", m)]) | |
48 | + | } | |
37 | 49 | } | |
38 | 50 | ||
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 | + | } | |
39 | 84 |
github/deemru/w8io/169f3d6 44.22 ms ◑