tx · 4aE1RWDGZvnqb3TTzcMkPUVp36YCCjz72vqBWZVEZuTf

3Mr9dr53WfCEhsUAUdVw5pgy5X8VXQSiNE1:  -0.01400000 Waves

2019.11.14 18:53 [764939] smart account 3Mr9dr53WfCEhsUAUdVw5pgy5X8VXQSiNE1 > SELF 0.00000000 Waves

{ "type": 13, "id": "4aE1RWDGZvnqb3TTzcMkPUVp36YCCjz72vqBWZVEZuTf", "fee": 1400000, "feeAssetId": null, "timestamp": 1573746426424, "version": 1, "sender": "3Mr9dr53WfCEhsUAUdVw5pgy5X8VXQSiNE1", "senderPublicKey": "5JzGcJEtLxWD9C1pzmvrj77LkgxLZGFd1RaierZeLnfP", "proofs": [ "4PtiUUtTLFH2L5YTFAUXXyjeDfr4dzhn4FCHYtDV8Tb55b5NP2G7we2M4edG1SvobGz46pjRhe2tg29ZR86XwVXW" ], "script": "base64:AAIDAAAAAAAAAAsIARIDCgEIEgASAAAAAAQAAAAAE2xvdHRlcnlUaWNrZXRIb2xkZXIJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQY85hy7YeAyDRGFObJCypdEQTLdt733vIAAAAADGxvdHRlcnlPd25lcgIAAAAjM014dHpuY0tNOXgxa0twTFAzc3A4V1pQdmcxY3phOGpIR20AAAAAC293bmVyUHViS2V5AQAAACCmNNugTM3YDCyk7xZ6vz/eGflRJPu15vOIW0V7gpcRMAAAAAARZEFwcFJhbmRvbUFkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQs+qsE+m8UScrki/mi9Vg1BPLz1NtSCiEAAAADAAAACmNvbnRleHRPYmoBAAAAF3JhbmRvbVJlcXVlc3RUeElkUmVjb3JkAAAAAQAAABFyYW5kb21SZXF1ZXN0VHhJZAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMCAAAAEXJhbmRvbVJlcXVlc3RUeElkCQAAAgAAAAECAAAAInJhbmRvbUlkVHggaXMgYWxyZWFkeSBpbiB0aGUgc3RhdG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AEAAAACBQAAAAckbWF0Y2gwAgAAABBMZWFzZVRyYW5zYWN0aW9uBAAAAAFsBQAAAAckbWF0Y2gwAwMDCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAGYAAAACBQAAAA5oZWlnaHRFbmRMZWFzZQUAAAAGaGVpZ2h0BwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwIAAAANd2lubmVyQWRkcmVzcwcJAAAAAAAAAggFAAAAAWwAAAAJcmVjaXBpZW50CQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAA13aW5uZXJBZGRyZXNzBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAWTGVhc2VDYW5jZWxUcmFuc2FjdGlvbgQAAAACbGMFAAAAByRtYXRjaDADCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5BwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAABBoZWlnaHRTdGFydExlYXNlCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALb3duZXJQdWJLZXkHBjMLcbo=", "chainId": 84, "height": 764939, "spentComplexity": 0 } View: original | compacted Prev: CSieLaun5j5Pqries2LxXRUPiGBgyuaJeCJxKAtPbwF6 Next: F1HWUuNrY8Qt9q7A6AMoRzGk7R8ngCtCnpWGTAY41C13 Diff:
OldNewDifferences
4343 WriteSet([DataEntry("randomResult", randomResultUpdate)])
4444 }
4545 else {
46- let winnerAddress = getIntegerValue(lotteryTicketHolder, ("ticket" + toString(randomResult)))
46+ let winnerAddress = getStringValue(lotteryTicketHolder, ("ticket" + toString(randomResult)))
4747 WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress)])
4848 }
4949 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lotteryTicketHolder = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP')
55
66 let lotteryOwner = "3MxtzncKM9x1kKpLP3sp8WZPvg1cza8jHGm"
77
88 let ownerPubKey = base58'CBoRgqiPjXZMaoN8BwCSFfXsRX5jvNDiZ9SArkfMQX1Z'
99
1010 let dAppRandomAddress = Address(base58'3Mt1uo5ieYK8Pk9XyVZp88HBLMfprrq515z')
1111
1212 @Callable(contextObj)
1313 func randomRequestTxIdRecord (randomRequestTxId) = if (isDefined(getString(this, "randomRequestTxId")))
1414 then throw("randomIdTx is already in the state")
1515 else if ((contextObj.caller == addressFromString(lotteryOwner)))
1616 then WriteSet([DataEntry("randomRequestTxId", randomRequestTxId)])
1717 else throw("only owner can start the lottery")
1818
1919
2020
2121 @Callable(contextObj)
2222 func checkRandom () = {
2323 let randomRequestCommitedTxId = getStringValue(this, "randomRequestTxId")
2424 let randomResponse = getStringValue(dAppRandomAddress, randomRequestCommitedTxId)
2525 let status = split(randomResponse, "_")[0]
2626 let randomResult = split(randomResponse, "--")[1]
2727 if ((status == "FINISHED"))
2828 then WriteSet([DataEntry("randomResult", parseIntValue(randomResult))])
2929 else throw("Incorrect random result")
3030 }
3131
3232
3333
3434 @Callable(contextObj)
3535 func defineTheWinner () = {
3636 let randomResult = getIntegerValue(this, "randomResult")
3737 if (isDefined(getInteger(lotteryTicketHolder, ("winningTicket" + toString(randomResult)))))
3838 then {
3939 let ticketAmount = getIntegerValue(lotteryTicketHolder, "ticketAmount")
4040 let randomResultUpdate = if ((randomResult == ticketAmount))
4141 then 1
4242 else (randomResult + 1)
4343 WriteSet([DataEntry("randomResult", randomResultUpdate)])
4444 }
4545 else {
46- let winnerAddress = getIntegerValue(lotteryTicketHolder, ("ticket" + toString(randomResult)))
46+ let winnerAddress = getStringValue(lotteryTicketHolder, ("ticket" + toString(randomResult)))
4747 WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress)])
4848 }
4949 }
5050
5151
5252 @Verifier(tx)
5353 func verify () = {
5454 let heightStartLease = 1
5555 let heightEndLease = 0
5656 match tx {
5757 case l: LeaseTransaction =>
5858 if (if (if ((height > heightStartLease))
5959 then (heightEndLease > height)
6060 else false)
6161 then isDefined(getString(this, "winnerAddress"))
6262 else false)
6363 then (l.recipient == addressFromString(getStringValue(this, "winnerAddress")))
6464 else false
6565 case lc: LeaseCancelTransaction =>
6666 if ((height > heightStartLease))
6767 then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
6868 else false
6969 case t: TransferTransaction =>
7070 if ((height > heightStartLease))
7171 then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey)
7272 else false
7373 case _ =>
7474 true
7575 }
7676 }
7777

github/deemru/w8io/026f985 
30.02 ms