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/mi9Vg1BPLz1NtSCiEAAAADAAAACmNvbnRleHRPYmoBAAAAF3JhbmRvbVJlcXVlc3RUeElkUmVjb3JkAAAAAQAAABFyYW5kb21SZXF1ZXN0VHhJZAMJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMCAAAAEXJhbmRvbVJlcXVlc3RUeElkCQAAAgAAAAECAAAAInJhbmRvbUlkVHggaXMgYWxyZWFkeSBpbiB0aGUgc3RhdGU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EAAAACBQAAAAckbWF0Y2gwAgAAABBMZWFzZVRyYW5zYWN0aW9uBAAAAAFsBQAAAAckbWF0Y2gwAwMDCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAGYAAAACBQAAAA5oZWlnaHRFbmRMZWFzZQUAAAAGaGVpZ2h0BwkBAAAACWlzRGVmaW5lZAAAAAEJAAQdAAAAAgUAAAAEdGhpcwIAAAANd2lubmVyQWRkcmVzcwcJAAAAAAAAAggFAAAAAWwAAAAJcmVjaXBpZW50CQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAA13aW5uZXJBZGRyZXNzBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAWTGVhc2VDYW5jZWxUcmFuc2FjdGlvbgQAAAACbGMFAAAAByRtYXRjaDADCQAAZgAAAAIFAAAABmhlaWdodAUAAAAQaGVpZ2h0U3RhcnRMZWFzZQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAC293bmVyUHViS2V5BwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAABBoZWlnaHRTdGFydExlYXNlCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAALb3duZXJQdWJLZXkHBjMLcbo=", "chainId": 84, "height": 764939, "spentComplexity": 0 } View: original | compacted Prev: CSieLaun5j5Pqries2LxXRUPiGBgyuaJeCJxKAtPbwF6 Next: F1HWUuNrY8Qt9q7A6AMoRzGk7R8ngCtCnpWGTAY41C13 Diff:
Old | New | Differences | |
---|---|---|---|
43 | 43 | WriteSet([DataEntry("randomResult", randomResultUpdate)]) | |
44 | 44 | } | |
45 | 45 | else { | |
46 | - | let winnerAddress = | |
46 | + | let winnerAddress = getStringValue(lotteryTicketHolder, ("ticket" + toString(randomResult))) | |
47 | 47 | WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress)]) | |
48 | 48 | } | |
49 | 49 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lotteryTicketHolder = Address(base58'3MrC1oqVCoLkfHabhJtrLJS6GxcooQwRWuP') | |
5 | 5 | ||
6 | 6 | let lotteryOwner = "3MxtzncKM9x1kKpLP3sp8WZPvg1cza8jHGm" | |
7 | 7 | ||
8 | 8 | let ownerPubKey = base58'CBoRgqiPjXZMaoN8BwCSFfXsRX5jvNDiZ9SArkfMQX1Z' | |
9 | 9 | ||
10 | 10 | let dAppRandomAddress = Address(base58'3Mt1uo5ieYK8Pk9XyVZp88HBLMfprrq515z') | |
11 | 11 | ||
12 | 12 | @Callable(contextObj) | |
13 | 13 | func randomRequestTxIdRecord (randomRequestTxId) = if (isDefined(getString(this, "randomRequestTxId"))) | |
14 | 14 | then throw("randomIdTx is already in the state") | |
15 | 15 | else if ((contextObj.caller == addressFromString(lotteryOwner))) | |
16 | 16 | then WriteSet([DataEntry("randomRequestTxId", randomRequestTxId)]) | |
17 | 17 | else throw("only owner can start the lottery") | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | 21 | @Callable(contextObj) | |
22 | 22 | func checkRandom () = { | |
23 | 23 | let randomRequestCommitedTxId = getStringValue(this, "randomRequestTxId") | |
24 | 24 | let randomResponse = getStringValue(dAppRandomAddress, randomRequestCommitedTxId) | |
25 | 25 | let status = split(randomResponse, "_")[0] | |
26 | 26 | let randomResult = split(randomResponse, "--")[1] | |
27 | 27 | if ((status == "FINISHED")) | |
28 | 28 | then WriteSet([DataEntry("randomResult", parseIntValue(randomResult))]) | |
29 | 29 | else throw("Incorrect random result") | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | 34 | @Callable(contextObj) | |
35 | 35 | func defineTheWinner () = { | |
36 | 36 | let randomResult = getIntegerValue(this, "randomResult") | |
37 | 37 | if (isDefined(getInteger(lotteryTicketHolder, ("winningTicket" + toString(randomResult))))) | |
38 | 38 | then { | |
39 | 39 | let ticketAmount = getIntegerValue(lotteryTicketHolder, "ticketAmount") | |
40 | 40 | let randomResultUpdate = if ((randomResult == ticketAmount)) | |
41 | 41 | then 1 | |
42 | 42 | else (randomResult + 1) | |
43 | 43 | WriteSet([DataEntry("randomResult", randomResultUpdate)]) | |
44 | 44 | } | |
45 | 45 | else { | |
46 | - | let winnerAddress = | |
46 | + | let winnerAddress = getStringValue(lotteryTicketHolder, ("ticket" + toString(randomResult))) | |
47 | 47 | WriteSet([DataEntry("winnerTicket", randomResult), DataEntry("winnerAddress", winnerAddress)]) | |
48 | 48 | } | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Verifier(tx) | |
53 | 53 | func verify () = { | |
54 | 54 | let heightStartLease = 1 | |
55 | 55 | let heightEndLease = 0 | |
56 | 56 | match tx { | |
57 | 57 | case l: LeaseTransaction => | |
58 | 58 | if (if (if ((height > heightStartLease)) | |
59 | 59 | then (heightEndLease > height) | |
60 | 60 | else false) | |
61 | 61 | then isDefined(getString(this, "winnerAddress")) | |
62 | 62 | else false) | |
63 | 63 | then (l.recipient == addressFromString(getStringValue(this, "winnerAddress"))) | |
64 | 64 | else false | |
65 | 65 | case lc: LeaseCancelTransaction => | |
66 | 66 | if ((height > heightStartLease)) | |
67 | 67 | then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey) | |
68 | 68 | else false | |
69 | 69 | case t: TransferTransaction => | |
70 | 70 | if ((height > heightStartLease)) | |
71 | 71 | then sigVerify(tx.bodyBytes, tx.proofs[0], ownerPubKey) | |
72 | 72 | else false | |
73 | 73 | case _ => | |
74 | 74 | true | |
75 | 75 | } | |
76 | 76 | } | |
77 | 77 |
github/deemru/w8io/026f985 46.08 ms ◑