tx · EUxYoayfsQerG5zKN8VPPHLdiNPQ7qFyQeHFc5dL1wFk 3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL: -0.05000000 Waves 2021.02.20 13:27 [1406343] smart account 3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL > SELF 0.00000000 Waves
{ "type": 13, "id": "EUxYoayfsQerG5zKN8VPPHLdiNPQ7qFyQeHFc5dL1wFk", "fee": 5000000, "feeAssetId": null, "timestamp": 1613816892204, "version": 2, "chainId": 84, "sender": "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL", "senderPublicKey": "AwmS57W97dpK3Bs6tsewG3YaYgJukDtmEZFbG1oQTV4T", "proofs": [ "26eaUC1DpcBVnyPmfWS2eAsqUkXuaQAC5ZFmRvbZdmcf4BcYPpsM18Xhz3juWx6ovANdQCR7Db2fvD3ZAZh5e2sE" ], "script": "base64:AAIDAAAAAAAAABAIARIDCgEIEgASAwoBARIAAAAACgAAAAAHUlVOTklORwIAAAAHUlVOTklORwAAAAAGQ0xPU0VEAgAAAAZDTE9TRUQAAAAACENBTkNFTEVEAgAAAAhDQU5DRUxFRAAAAAAJREFQUE9XTkVSAgAAACMzTkJFYkZVNmRLcG9BY3NiYUVLMmFDNjJVUU1qWUZXNHhpTAAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAAAAAANGRUUAAAAAAAANu6ABAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAPZXh0cmFjdGVkTnVtYmVyAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AQAAAAxXYXZlc0xvdHRvVjIJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADLA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AnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBgkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24JAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgYGL5He7A==", "height": 1406343, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bqg2a9kuT4GLzNY7NyDAxW9pLYjkr6wQvcByBT1n1rvp Next: BBA6ikxTzfDaKfNyKKqRpPqdEaZPNzEJ7vUoiZzWyMKS Diff:
Old | New | Differences | |
---|---|---|---|
125 | 125 | let winningBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(1))) | |
126 | 126 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight")) | |
127 | 127 | let account = toBase58String(i.caller.bytes) | |
128 | - | let | |
128 | + | let prize = (wavesBalance(this) - 100000) | |
129 | 129 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
130 | 130 | if ((account != DAPPOWNER)) | |
131 | 131 | then throw("Only dAPP Owner can Close the Lottery.") | |
133 | 133 | then throw(("Cannot close a contest in status: " + contestCurrStatus)) | |
134 | 134 | else if ((winningBetAccount != NONE)) | |
135 | 135 | then { | |
136 | - | let Prize = wavesBalance(this) | |
137 | - | let winTransfer = TransferSet([ScriptTransfer(extract(addressFromString(winningBetAccount)), Prize, unit)]) | |
138 | - | ScriptResult(WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winningBetAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_rateheight"), height), DataEntry((("contest_" + toString(contestCurrNumber)) + "_extractedNumber"), extractedNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_prize"), Prize)]), winTransfer) | |
136 | + | let winTransfer = TransferSet([ScriptTransfer(extract(addressFromString(winningBetAccount)), prize, unit)]) | |
137 | + | ScriptResult(WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winningBetAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_rateheight"), height), DataEntry((("contest_" + toString(contestCurrNumber)) + "_extractedNumber"), extractedNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_prize"), prize)]), winTransfer) | |
139 | 138 | } | |
140 | 139 | else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winningBetAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_extractedNumber"), extractedNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_prize"), 0)]) | |
141 | 140 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RUNNING = "RUNNING" | |
5 | 5 | ||
6 | 6 | let CLOSED = "CLOSED" | |
7 | 7 | ||
8 | 8 | let CANCELED = "CANCELED" | |
9 | 9 | ||
10 | 10 | let DAPPOWNER = "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL" | |
11 | 11 | ||
12 | 12 | let WAVES = "WAVES" | |
13 | 13 | ||
14 | 14 | let NONE = "NONE" | |
15 | 15 | ||
16 | 16 | let FEE = 900000 | |
17 | 17 | ||
18 | 18 | func randomizer (inv) = { | |
19 | 19 | let lastPlay = match getBinary(this, "extractedNumber") { | |
20 | 20 | case s: ByteVector => | |
21 | 21 | s | |
22 | 22 | case _: Unit => | |
23 | 23 | base58'2ee4oFDYriWJ9EMeR' | |
24 | 24 | case _ => | |
25 | 25 | throw("Match error") | |
26 | 26 | } | |
27 | 27 | let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height)) | |
28 | 28 | sha256(rand) | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func getNumByKey (key) = { | |
33 | 33 | let num = match getInteger(this, key) { | |
34 | 34 | case a: Int => | |
35 | 35 | a | |
36 | 36 | case _ => | |
37 | 37 | 0 | |
38 | 38 | } | |
39 | 39 | num | |
40 | 40 | } | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getStrByKey (key) = { | |
44 | 44 | let str = match getString(this, key) { | |
45 | 45 | case a: String => | |
46 | 46 | a | |
47 | 47 | case _ => | |
48 | 48 | NONE | |
49 | 49 | } | |
50 | 50 | str | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | @Callable(i) | |
55 | 55 | func setContestStatus (contestStatus) = { | |
56 | 56 | let account = toBase58String(i.caller.bytes) | |
57 | 57 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
58 | 58 | if ((account != DAPPOWNER)) | |
59 | 59 | then throw("Only dAPP Owner can set Contest Status.") | |
60 | 60 | else if (if ((contestStatus != CANCELED)) | |
61 | 61 | then (contestStatus != CLOSED) | |
62 | 62 | else false) | |
63 | 63 | then throw(("Invalid status: " + contestStatus)) | |
64 | 64 | else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), contestStatus)]) | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func setContestConfiguration () = { | |
71 | 71 | let account = toBase58String(i.caller.bytes) | |
72 | 72 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
73 | 73 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
74 | 74 | let contestNewNumber = (contestCurrNumber + 1) | |
75 | 75 | let balance = wavesBalance(this) | |
76 | 76 | if ((account != DAPPOWNER)) | |
77 | 77 | then throw(((("Only dAPP Owner can Configure Contest. Caller account: " + account) + " dapp owner: ") + DAPPOWNER)) | |
78 | 78 | else if ((contestCurrStatus == RUNNING)) | |
79 | 79 | then throw(("You cannot configure a new Contest while old Contest status is: " + contestCurrStatus)) | |
80 | 80 | else { | |
81 | 81 | let contestFinishHeight = (height + (6 * 1440)) | |
82 | 82 | WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_betcounter"), 0)]) | |
83 | 83 | } | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | ||
88 | 88 | @Callable(i) | |
89 | 89 | func bet (guessedNumber) = { | |
90 | 90 | let account = toBase58String(i.caller.bytes) | |
91 | 91 | let pmt = extract(i.payment) | |
92 | 92 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
93 | 93 | let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_startheight")) | |
94 | 94 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight")) | |
95 | 95 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
96 | 96 | let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
97 | 97 | let accountBetsNumber = getNumByKey((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets")) | |
98 | 98 | let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber))) | |
99 | 99 | if ((height > (contestFinishHeight - (2 * 1440)))) | |
100 | 100 | then throw("You cannot bet anymore at this height.") | |
101 | 101 | else if ((contestCurrStatus != RUNNING)) | |
102 | 102 | then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus)) | |
103 | 103 | else if (if ((existingBetAccount != NONE)) | |
104 | 104 | then (existingBetAccount != account) | |
105 | 105 | else false) | |
106 | 106 | then throw((("Another wallet: " + existingBetAccount) + " took this number.")) | |
107 | 107 | else if ((accountBetsNumber >= 1)) | |
108 | 108 | then throw("You can chose at most one number.") | |
109 | 109 | else if ((contestCurrStatus != RUNNING)) | |
110 | 110 | then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus)) | |
111 | 111 | else if (if ((0 > guessedNumber)) | |
112 | 112 | then true | |
113 | 113 | else (guessedNumber > 99)) | |
114 | 114 | then throw("You can select a number between 0 and 99") | |
115 | 115 | else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))]) | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func closecontest () = { | |
122 | 122 | let rand = randomizer(i) | |
123 | 123 | let extractedNumber = (toInt(rand) % 2) | |
124 | 124 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
125 | 125 | let winningBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(1))) | |
126 | 126 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight")) | |
127 | 127 | let account = toBase58String(i.caller.bytes) | |
128 | - | let | |
128 | + | let prize = (wavesBalance(this) - 100000) | |
129 | 129 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
130 | 130 | if ((account != DAPPOWNER)) | |
131 | 131 | then throw("Only dAPP Owner can Close the Lottery.") | |
132 | 132 | else if ((contestCurrStatus != RUNNING)) | |
133 | 133 | then throw(("Cannot close a contest in status: " + contestCurrStatus)) | |
134 | 134 | else if ((winningBetAccount != NONE)) | |
135 | 135 | then { | |
136 | - | let Prize = wavesBalance(this) | |
137 | - | let winTransfer = TransferSet([ScriptTransfer(extract(addressFromString(winningBetAccount)), Prize, unit)]) | |
138 | - | ScriptResult(WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winningBetAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_rateheight"), height), DataEntry((("contest_" + toString(contestCurrNumber)) + "_extractedNumber"), extractedNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_prize"), Prize)]), winTransfer) | |
136 | + | let winTransfer = TransferSet([ScriptTransfer(extract(addressFromString(winningBetAccount)), prize, unit)]) | |
137 | + | ScriptResult(WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winningBetAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_rateheight"), height), DataEntry((("contest_" + toString(contestCurrNumber)) + "_extractedNumber"), extractedNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_prize"), prize)]), winTransfer) | |
139 | 138 | } | |
140 | 139 | else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winningBetAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_extractedNumber"), extractedNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_prize"), 0)]) | |
141 | 140 | } | |
142 | 141 | ||
143 | 142 | ||
144 | 143 | @Verifier(tx) | |
145 | 144 | func verify () = match tx { | |
146 | 145 | case _: SetScriptTransaction|DataTransaction => | |
147 | 146 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
148 | 147 | case _: InvokeScriptTransaction => | |
149 | 148 | true | |
150 | 149 | case _ => | |
151 | 150 | true | |
152 | 151 | } | |
153 | 152 |
github/deemru/w8io/026f985 36.70 ms ◑