tx · BPmSKQwcRCDK6W8Nav6sbcoX5NdEtSWwnpNrpj5rHZbk

3NBk9xCdSVdSZE6uLnPJosLU9TftKVJjMvU:  -0.01000000 Waves

2019.11.25 15:22 [780779] smart account 3NBk9xCdSVdSZE6uLnPJosLU9TftKVJjMvU > SELF 0.00000000 Waves

{ "type": 13, "id": "BPmSKQwcRCDK6W8Nav6sbcoX5NdEtSWwnpNrpj5rHZbk", "fee": 1000000, "feeAssetId": null, "timestamp": 1574684561446, "version": 1, "sender": "3NBk9xCdSVdSZE6uLnPJosLU9TftKVJjMvU", "senderPublicKey": "3WiombxFNF4MptqXyJpdEcaNTLV7NXhKHTzvbAs5iGcz", "proofs": [ "VpD13zsYKj7kdvraSmtbwrcFyNsSDrWyEJeSg1CxmRTca3Ut6rd6hx8dYaFoxYhvNhJDASTQL5ouvmTeL4cBSCX" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgASABIAAAAABAAAAAATbG90dGVyeVRpY2tldEhvbGRlcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVBjzmHLth4DINEYU5skLKl0RBMt23vfe8gAAAAAMbG90dGVyeU93bmVyAgAAACMzTXh0em5jS005eDFrS3BMUDNzcDhXWlB2ZzFjemE4akhHbQAAAAALb3duZXJQdWJLZXkBAAAAIKY026BMzdgMLKTvFnq/P94Z+VEk+7Xm84hbRXuClxEwAAAAABFkQXBwUmFuZG9tQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVCz6qwT6bxRJyuSL+aL1WDUE8vPU21IKIQAAAAQAAAAKY29udGV4dE9iagEAAAAXcmFuZG9tUmVxdWVzdFR4SWRSZWNvcmQAAAABAAAAEXJhbmRvbVJlcXVlc3RUeElkAwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwIAAAARcmFuZG9tUmVxdWVzdFR4SWQJAAACAAAAAQIAAAAicmFuZG9tSWRUeCBpcyBhbHJlYWR5IGluIHRoZSBzdGF0ZQMJA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AAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAA13aW5uZXJBZGRyZXNzBAAAAAl3aW5IZWlnaHQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAACXdpbkhlaWdodAQAAAAMb3duZXJBZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAtvd25lclB1YktleQQAAAAFbW9udGgAAAAAAAAAqMADAwkAAAAAAAACCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADXdpbm5lckFkZHJlc3MJAABnAAAAAgkAAGQAAAACBQAAAAl3aW5IZWlnaHQFAAAABW1vbnRoBQAAAAZoZWlnaHQHCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADXdpbm5lckFkZHJlc3MJAAPrAAAAAgUAAAAEdGhpcwUAAAAEdW5pdAUAAAAEdW5pdAUAAAADbmlsAwMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAADGxvdHRlcnlPd25lcgkAAGYAAAACBQAAAAZoZWlnaHQJAABkAAAAAgUAAAAJd2luSGVpZ2h0BQAAAAVtb250aAcJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMb3duZXJBZGRyZXNzCQAD6wAAAAIFAAAABHRoaXMFAAAABHVuaXQFAAAABHVuaXQFAAAAA25pbAkAAAIAAAABAgAAABx5b3UgY2FuJ3Qgd2l0aGRyYXcgdGhlIGZ1bmRzAAAAAAfw6VM=", "chainId": 84, "height": 780779, "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 = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP')
5+
6+let lotteryOwner = "3MxtzncKM9x1kKpLP3sp8WZPvg1cza8jHGm"
7+
8+let ownerPubKey = base58'CBoRgqiPjXZMaoN8BwCSFfXsRX5jvNDiZ9SArkfMQX1Z'
9+
10+let dAppRandomAddress = Address(base58'3Mt1uo5ieYK8Pk9XyVZp88HBLMfprrq515z')
11+
12+@Callable(contextObj)
13+func randomRequestTxIdRecord (randomRequestTxId) = if (isDefined(getString(this, "randomRequestTxId")))
14+ then throw("randomIdTx is already in the state")
15+ else if ((contextObj.caller == addressFromString(lotteryOwner)))
16+ then WriteSet([DataEntry("randomRequestTxId", randomRequestTxId)])
17+ else throw("only owner can start the lottery")
18+
19+
20+
21+@Callable(contextObj)
22+func checkRandom () = {
23+ let randomRequestCommitedTxId = getStringValue(this, "randomRequestTxId")
24+ let randomResponse = getStringValue(dAppRandomAddress, randomRequestCommitedTxId)
25+ let status = split(randomResponse, "_")[0]
26+ let randomResult = split(randomResponse, "--")[1]
27+ if ((status == "FINISHED"))
28+ then WriteSet([DataEntry("randomResult", parseIntValue(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(getInteger(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 = getStringValue(lotteryTicketHolder, ("ticket" + toString(randomResult)))
47+ WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress), DataEntry("winHeight", height)])
48+ }
49+ }
50+
51+
52+
53+@Callable(contextObj)
54+func withdraw () = {
55+ let winnerAddress = addressFromStringValue(getStringValue(this, "winnerAddress"))
56+ let winHeight = getIntegerValue(this, "winHeight")
57+ let ownerAddress = addressFromPublicKey(ownerPubKey)
58+ let month = 43200
59+ if (if ((contextObj.caller == winnerAddress))
60+ then ((winHeight + month) >= height)
61+ else false)
62+ then TransferSet([ScriptTransfer(winnerAddress, assetBalance(this, unit), unit)])
63+ else if (if ((contextObj.caller == addressFromStringValue(lotteryOwner)))
64+ then (height > (winHeight + month))
65+ else false)
66+ then TransferSet([ScriptTransfer(ownerAddress, assetBalance(this, unit), unit)])
67+ else throw("you can't withdraw the funds")
68+ }
69+
70+

github/deemru/w8io/026f985 
17.07 ms