tx · 2f5x7nbCvqQJdbYXRvaAsrQiQZwqDGMJUjirizcv1Ys7

3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL:  -0.05000000 Waves

2021.02.20 13:17 [1406333] smart account 3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL > SELF 0.00000000 Waves

{ "type": 13, "id": "2f5x7nbCvqQJdbYXRvaAsrQiQZwqDGMJUjirizcv1Ys7", "fee": 5000000, "feeAssetId": null, "timestamp": 1613816281594, "version": 2, "chainId": 84, "sender": "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL", "senderPublicKey": "AwmS57W97dpK3Bs6tsewG3YaYgJukDtmEZFbG1oQTV4T", "proofs": [ "5UNVMh8PLxZVwZg7bXVYGc7gJ8Xq379z6Csg44EWg3NZK1T1JeKb3b7QH1X5k1hgUktdvNhzd8HhPMGQeMvkeeb6" ], "script": "base64:AAIDAAAAAAAAABAIARIDCgEIEgASAwoBARIAAAAACgAAAAAHUlVOTklORwIAAAAHUlVOTklORwAAAAAGQ0xPU0VEAgAAAAZDTE9TRUQAAAAACENBTkNFTEVEAgAAAAhDQU5DRUxFRAAAAAAJREFQUE9XTkVSAgAAACMzTkJFYkZVNmRLcG9BY3NiYUVLMmFDNjJVUU1qWUZXNHhpTAAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAAAAAANGRUUAAAAAAAANu6ABAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAPZXh0cmFjdGVkTnVtYmVyAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AQAAAAxXYXZlc0xvdHRvVjIJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADL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ZfcHJpemUAAAAAAAAAAAAFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24GCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBgaBenii", "height": 1406333, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FHKMHqtsJvcUSfThRCv79fBVZDJ2cT15z2QAkWbBBmkS Next: Bqg2a9kuT4GLzNY7NyDAxW9pLYjkr6wQvcByBT1n1rvp Diff:
OldNewDifferences
8686
8787
8888 @Callable(i)
89-func bet (currencyValue) = {
89+func bet (guessedNumber) = {
9090 let account = toBase58String(i.caller.bytes)
9191 let pmt = extract(i.payment)
9292 let contestCurrNumber = getNumByKey("contest_currentnumber")
9595 let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
9696 let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
9797 let accountBetsNumber = getNumByKey((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"))
98- let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(currencyValue)))
98+ let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber)))
9999 if ((height > (contestFinishHeight - (2 * 1440))))
100100 then throw("You cannot bet anymore at this height.")
101101 else if ((contestCurrStatus != RUNNING))
106106 then throw((("Another wallet: " + existingBetAccount) + " took this number."))
107107 else if ((accountBetsNumber >= 1))
108108 then throw("You can chose at most one number.")
109- else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(currencyValue)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))])
109+ else if ((contestCurrStatus != RUNNING))
110+ then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus))
111+ else if (if ((0 > guessedNumber))
112+ then true
113+ else (guessedNumber > 99))
114+ then throw("You can select a number between 0 and 99")
115+ else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))])
110116 }
111117
112118
114120 @Callable(i)
115121 func closecontest () = {
116122 let rand = randomizer(i)
117- let extractedNumber = (toInt(rand) % 90)
123+ let extractedNumber = (toInt(rand) % 100)
118124 let contestCurrNumber = getNumByKey("contest_currentnumber")
119125 let winningBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(1)))
120126 let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight"))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RUNNING = "RUNNING"
55
66 let CLOSED = "CLOSED"
77
88 let CANCELED = "CANCELED"
99
1010 let DAPPOWNER = "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL"
1111
1212 let WAVES = "WAVES"
1313
1414 let NONE = "NONE"
1515
1616 let FEE = 900000
1717
1818 func randomizer (inv) = {
1919 let lastPlay = match getBinary(this, "extractedNumber") {
2020 case s: ByteVector =>
2121 s
2222 case _: Unit =>
2323 base58'2ee4oFDYriWJ9EMeR'
2424 case _ =>
2525 throw("Match error")
2626 }
2727 let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
2828 sha256(rand)
2929 }
3030
3131
3232 func getNumByKey (key) = {
3333 let num = match getInteger(this, key) {
3434 case a: Int =>
3535 a
3636 case _ =>
3737 0
3838 }
3939 num
4040 }
4141
4242
4343 func getStrByKey (key) = {
4444 let str = match getString(this, key) {
4545 case a: String =>
4646 a
4747 case _ =>
4848 NONE
4949 }
5050 str
5151 }
5252
5353
5454 @Callable(i)
5555 func setContestStatus (contestStatus) = {
5656 let account = toBase58String(i.caller.bytes)
5757 let contestCurrNumber = getNumByKey("contest_currentnumber")
5858 if ((account != DAPPOWNER))
5959 then throw("Only dAPP Owner can set Contest Status.")
6060 else if (if ((contestStatus != CANCELED))
6161 then (contestStatus != CLOSED)
6262 else false)
6363 then throw(("Invalid status: " + contestStatus))
6464 else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), contestStatus)])
6565 }
6666
6767
6868
6969 @Callable(i)
7070 func setContestConfiguration () = {
7171 let account = toBase58String(i.caller.bytes)
7272 let contestCurrNumber = getNumByKey("contest_currentnumber")
7373 let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
7474 let contestNewNumber = (contestCurrNumber + 1)
7575 let balance = wavesBalance(this)
7676 if ((account != DAPPOWNER))
7777 then throw(((("Only dAPP Owner can Configure Contest. Caller account: " + account) + " dapp owner: ") + DAPPOWNER))
7878 else if ((contestCurrStatus == RUNNING))
7979 then throw(("You cannot configure a new Contest while old Contest status is: " + contestCurrStatus))
8080 else {
8181 let contestFinishHeight = (height + (6 * 1440))
8282 WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_betcounter"), 0)])
8383 }
8484 }
8585
8686
8787
8888 @Callable(i)
89-func bet (currencyValue) = {
89+func bet (guessedNumber) = {
9090 let account = toBase58String(i.caller.bytes)
9191 let pmt = extract(i.payment)
9292 let contestCurrNumber = getNumByKey("contest_currentnumber")
9393 let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_startheight"))
9494 let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight"))
9595 let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
9696 let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
9797 let accountBetsNumber = getNumByKey((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"))
98- let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(currencyValue)))
98+ let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber)))
9999 if ((height > (contestFinishHeight - (2 * 1440))))
100100 then throw("You cannot bet anymore at this height.")
101101 else if ((contestCurrStatus != RUNNING))
102102 then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus))
103103 else if (if ((existingBetAccount != NONE))
104104 then (existingBetAccount != account)
105105 else false)
106106 then throw((("Another wallet: " + existingBetAccount) + " took this number."))
107107 else if ((accountBetsNumber >= 1))
108108 then throw("You can chose at most one number.")
109- else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(currencyValue)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))])
109+ else if ((contestCurrStatus != RUNNING))
110+ then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus))
111+ else if (if ((0 > guessedNumber))
112+ then true
113+ else (guessedNumber > 99))
114+ then throw("You can select a number between 0 and 99")
115+ else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))])
110116 }
111117
112118
113119
114120 @Callable(i)
115121 func closecontest () = {
116122 let rand = randomizer(i)
117- let extractedNumber = (toInt(rand) % 90)
123+ let extractedNumber = (toInt(rand) % 100)
118124 let contestCurrNumber = getNumByKey("contest_currentnumber")
119125 let winningBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(1)))
120126 let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight"))
121127 let account = toBase58String(i.caller.bytes)
122128 let balance = wavesBalance(this)
123129 let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
124130 if ((account != DAPPOWNER))
125131 then throw("Only dAPP Owner can Close the Lottery.")
126132 else if ((contestCurrStatus != RUNNING))
127133 then throw(("Cannot close a contest in status: " + contestCurrStatus))
128134 else if ((winningBetAccount != NONE))
129135 then {
130136 let Prize = wavesBalance(this)
131137 let winTransfer = TransferSet([ScriptTransfer(extract(addressFromString(winningBetAccount)), Prize, unit)])
132138 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)
133139 }
134140 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)])
135141 }
136142
137143
138144 @Verifier(tx)
139145 func verify () = match tx {
140146 case _: SetScriptTransaction|DataTransaction =>
141147 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
142148 case _: InvokeScriptTransaction =>
143149 true
144150 case _ =>
145151 true
146152 }
147153

github/deemru/w8io/026f985 
36.38 ms