tx · Cqz5Tz5mFD9cVC5X6NvHN35YtNCN8WHQmeTYiBG2Pkyv

3MqizYpjHiZLWkFU9bYfvbB1EMJADqaoQzE:  -0.01000000 Waves

2019.11.27 13:55 [783583] smart account 3MqizYpjHiZLWkFU9bYfvbB1EMJADqaoQzE > SELF 0.00000000 Waves

{ "type": 13, "id": "Cqz5Tz5mFD9cVC5X6NvHN35YtNCN8WHQmeTYiBG2Pkyv", "fee": 1000000, "feeAssetId": null, "timestamp": 1574852125864, "version": 1, "sender": "3MqizYpjHiZLWkFU9bYfvbB1EMJADqaoQzE", "senderPublicKey": "Bypepzqx47pGcrhMN2Qut18i8knezKSRSpe7Ay8Rwum3", "proofs": [ "414Qyem52fjs7FGW2fpeS3LTSxefwDdj8AfgJ1KL4FA8ji37ssYeQDbZWHASMYCbdkBZFDSugUf1amBBW7dM27kB" ], "script": "base64:AAIDAAAAAAAAABAIARIDCgEIEgASAwoBCBIAAAAABAAAAAAMb3duZXJBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUGPOYcu2HgMg0RhTmyQsqXREEy3be997yAAAAABBsb3R0ZXJ5VGlja2V0SHViCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUmvyisho0FjUWwjIOQiooITMIPhbaEXpaAAAAABNsb3R0ZXJ5QWRtaW5BZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUGPOYcu2HgMg0RhTmyQsqXREEy3be997yAAAAABFkQXBwUmFuZG9tQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVE5D+kaTpxEsERIh+usnD1ONlaWe1KiigQAAAAQAAAAKY29udGV4dE9iagEAAAAXcmVnaXN0ZXJSYW5kb21SZXF1ZXN0VHgAAAABAAAAD3JhbmRvbVJlcXVlc3RUeAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMCAAAAD3JhbmRvbVJlcXVlc3RUeAkAAAIAAAABAgAAACdyYW5kb21SZXF1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JhbGFuY2UAAAABBQAAAAR0aGlzBQAAAAR1bml0BQAAAANuaWwDAwMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAABNsb3R0ZXJ5QWRtaW5BZGRyZXNzBgkAAAAAAAACCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADG93bmVyQWRkcmVzcwkAAGYAAAACBQAAAAZoZWlnaHQJAABkAAAAAgUAAAAJd2luSGVpZ2h0BQAAAAVtb250aAcJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMb3duZXJBZGRyZXNzCQEAAAAMd2F2ZXNCYWxhbmNlAAAAAQUAAAAEdGhpcwUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHHlvdSBjYW4ndCB3aXRoZHJhdyB0aGUgZnVuZHMAAAAAJ7hL8A==", "chainId": 84, "height": 783583, "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 ownerAddress = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP')
5+
6+let lotteryTicketHub = Address(base58'3N43aUtPRNbdKU1QmE6hsrzWeYViKxRn9wP')
7+
8+let lotteryAdminAddress = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP')
9+
10+let dAppRandomAddress = Address(base58'3Mw3uv3zsndD2x53YK9xE5QbVCjXnExVMsn')
11+
12+@Callable(contextObj)
13+func registerRandomRequestTx (randomRequestTx) = if (isDefined(getString(this, "randomRequestTx")))
14+ then throw("randomRequestTx is already in the state")
15+ else if (isDefined(transactionHeightById(fromBase58String(randomRequestTx))))
16+ then throw("You try register tx which is already in blockchain")
17+ else if ((contextObj.caller == lotteryAdminAddress))
18+ then WriteSet([DataEntry("randomRequestTx", randomRequestTx)])
19+ else throw("only loteryOwner can start the lottery")
20+
21+
22+
23+@Callable(contextObj)
24+func checkRandom () = {
25+ let randomRequestCommitedTxId = getStringValue(this, "randomRequestTx")
26+ let randomResponse = getStringValue(dAppRandomAddress, randomRequestCommitedTxId)
27+ let status = split(randomResponse, "_")[0]
28+ let randomResult = split(randomResponse, "--")[1]
29+ if ((status == "FINISHED"))
30+ then WriteSet([DataEntry("randomResult", parseIntValue(randomResult))])
31+ else throw("Incorrect random result")
32+ }
33+
34+
35+
36+@Callable(contextObj)
37+func defineTheWinner (ticketsInHubKey) = {
38+ let randomResult = getIntegerValue(this, "randomResult")
39+ if (isDefined(getInteger(lotteryTicketHub, ("winningTicket" + toString(randomResult)))))
40+ then {
41+ let ticketAmount = getIntegerValue(lotteryTicketHub, "ticketAmount")
42+ let randomResultUpdate = if ((randomResult == ticketAmount))
43+ then 1
44+ else (randomResult + 1)
45+ WriteSet([DataEntry("randomResult", randomResultUpdate)])
46+ }
47+ else {
48+ let ticketFrom = parseIntValue(split(split(ticketsInHubKey, "To")[0], "ticketsFrom")[1])
49+ let ticketTo = parseIntValue(split(ticketsInHubKey, "To")[1])
50+ if (if ((randomResult >= ticketFrom))
51+ then (ticketTo >= randomResult)
52+ else false)
53+ then {
54+ let winnerAddress = getStringValue(lotteryTicketHub, ticketsInHubKey)
55+ WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress), DataEntry("winHeight", height)])
56+ }
57+ else throw("these tickets didn't win")
58+ }
59+ }
60+
61+
62+
63+@Callable(contextObj)
64+func withdraw () = {
65+ let winnerAddress = addressFromStringValue(getStringValue(this, "winnerAddress"))
66+ let winHeight = getIntegerValue(this, "winHeight")
67+ let month = 43200
68+ if (if ((contextObj.caller == winnerAddress))
69+ then ((winHeight + month) >= height)
70+ else false)
71+ then TransferSet([ScriptTransfer(winnerAddress, wavesBalance(this), unit)])
72+ else if (if (if ((contextObj.caller == lotteryAdminAddress))
73+ then true
74+ else (contextObj.caller == ownerAddress))
75+ then (height > (winHeight + month))
76+ else false)
77+ then TransferSet([ScriptTransfer(ownerAddress, wavesBalance(this), unit)])
78+ else throw("you can't withdraw the funds")
79+ }
80+
81+

github/deemru/w8io/026f985 
37.09 ms