tx · 2urN5XzPs5aGCqsskKpKsSyvBX7fEfFNW87LvLdF9eVo

3N5Ra96gWQ3YcryZwz4kYe6qKYBRwxtXfsP:  -0.01400000 Waves

2019.11.14 17:06 [764842] smart account 3N5Ra96gWQ3YcryZwz4kYe6qKYBRwxtXfsP > SELF 0.00000000 Waves

{ "type": 13, "id": "2urN5XzPs5aGCqsskKpKsSyvBX7fEfFNW87LvLdF9eVo", "fee": 1400000, "feeAssetId": null, "timestamp": 1573734101048, "version": 1, "sender": "3N5Ra96gWQ3YcryZwz4kYe6qKYBRwxtXfsP", "senderPublicKey": "G3j6grFbXzeqRm8PvzLkpFmiZZibrCDjSc2h2KsQAJLw", "proofs": [ "4k3TiTiim6CrsDfhVrNNsD2wuWJs5G3hEaxR5343GbXisXJT4vA1LepzWkkKmXgsKmJB4fhCbgwjqX6iqbcxrLkX" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgMKAQgSAAAAAAMAAAAAE2xvdHRlcnlUaWNrZXRIb2xkZXIJAQAAAAdleHRyYWN0AAAAAQkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM01wMUdHVWhiYUpWdTdFYWY4YktNR3IzQjI5R1ZqcmtldFQAAAAADGxvdHRlcnlPd25lcgIAAAAjM01yQzFvcVZDb0xrZkhhYmhKdHJMSlM2R3hjb29Rd1JXdVAAAAAAC293bmVyUHViS2V5AQAAABoBVBjzmHLth4DINEYU5skLKl0RBMt23vfe8gAAAAMAAAAKY29udGV4dE9iagEAAAAXcmFuZG9tUmVxdWVzdFR4SWRSZWNvcmQAAAABAAAAEXJhbmRvbVJlcXVlc3RUeElkAwkBAAAACWlzRGVmaW5lZAAAAAEJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAAEXJhbmRvbVJlcXVlc3RUeElkCQAAAgAAAAECAAAAInJhbmRvbUlkVHggaXMgYWxyZWFkeSBpbiB0aGUgc3RhdGUDCQAAAAAAAAIIBQAA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AAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABBMZWFzZVRyYW5zYWN0aW9uBAAAAAFsBQAAAAckbWF0Y2gwAwMDCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAGYAAAACBQAAAA5oZWlnaHRFbmRMZWFzZQUAAAAGaGVpZ2h0BwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwIAAAANd2lubmVyQWRkcmVzcwcJAAAAAAAAAggFAAAAAWwAAAAJcmVjaXBpZW50CQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAA13aW5uZXJBZGRyZXNzBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAWTGVhc2VDYW5jZWxUcmFuc2FjdGlvbgQAAAACbGMFAAAAByRtYXRjaDADCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5BwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAABBoZWlnaHRTdGFydExlYXNlCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALb3duZXJQdWJLZXkHB5djfVc=", "chainId": 84, "height": 764842, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let lotteryTicketHolder = extract(addressFromString("3Mp1GGUhbaJVu7Eaf8bKMGr3B29GVjrketT"))
5+
6+let lotteryOwner = "3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP"
7+
8+let ownerPubKey = base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP'
9+
10+@Callable(contextObj)
11+func randomRequestTxIdRecord (randomRequestTxId) = if (isDefined(getStringValue(this, "randomRequestTxId")))
12+ then throw("randomIdTx is already in the state")
13+ else if ((contextObj.caller == addressFromString(lotteryOwner)))
14+ then WriteSet([DataEntry("randomRequestTxId", randomRequestTxId)])
15+ else throw("only owner can start the lottery")
16+
17+
18+
19+@Callable(contextObj)
20+func checkRandom (randomResponse) = {
21+ let randomRequestCommitedTxId = getStringValue(this, "randomRequestTxId")
22+ let status = split(randomResponse, "_")[0]
23+ let randomTxId = split(randomResponse, "_")[1]
24+ let randomResult = split(randomResponse, "--")[1]
25+ if (if ((status == "FINISHED"))
26+ then (randomTxId == randomRequestCommitedTxId)
27+ else false)
28+ then WriteSet([DataEntry("randomResult", randomResult)])
29+ else throw("Incorrect random result")
30+ }
31+
32+
33+
34+@Callable(contextObj)
35+func defineTheWinner () = {
36+ let randomResult = getIntegerValue(this, "randomResult")
37+ if (isDefined(getIntegerValue(lotteryTicketHolder, ("winningTicket" + toString(randomResult)))))
38+ then {
39+ let ticketAmount = getIntegerValue(lotteryTicketHolder, "ticketAmount")
40+ let randomResultUpdate = if ((randomResult == ticketAmount))
41+ then 1
42+ else (randomResult + 1)
43+ WriteSet([DataEntry("randomResult", randomResultUpdate)])
44+ }
45+ else {
46+ let winnerAddress = getIntegerValue(lotteryTicketHolder, ("ticket" + toString(randomResult)))
47+ WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress)])
48+ }
49+ }
50+
51+
52+@Verifier(tx)
53+func verify () = {
54+ let heightStartLease = 1
55+ let heightEndLease = 0
56+ match tx {
57+ case l: LeaseTransaction =>
58+ if (if (if ((height > heightStartLease))
59+ then (heightEndLease > height)
60+ else false)
61+ then isDefined(getString(this, "winnerAddress"))
62+ else false)
63+ then (l.recipient == addressFromString(getStringValue(this, "winnerAddress")))
64+ else false
65+ case lc: LeaseCancelTransaction =>
66+ if ((height > heightStartLease))
67+ then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
68+ else false
69+ case t: TransferTransaction =>
70+ if ((height > heightStartLease))
71+ then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
72+ else false
73+ case _ =>
74+ false
75+ }
76+ }
77+

github/deemru/w8io/169f3d6 
24.85 ms