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:AAIDAAAAAAAAABAIARIDCgEIEgASAwoBARIAAAAACgAAAAAHUlVOTklORwIAAAAHUlVOTklORwAAAAAGQ0xPU0VEAgAAAAZDTE9TRUQAAAAACENBTkNFTEVEAgAAAAhDQU5DRUxFRAAAAAAJREFQUE9XTkVSAgAAACMzTkJFYkZVNmRLcG9BY3NiYUVLMmFDNjJVUU1qWUZXNHhpTAAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAAAAAANGRUUAAAAAAAANu6ABAAAACnJhbmRvbWl6ZXIAAAABAAAAA2ludgQAAAAIbGFzdFBsYXkEAAAAByRtYXRjaDAJAAQcAAAAAgUAAAAEdGhpcwIAAAAPZXh0cmFjdGVkTnVtYmVyAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9yBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AQAAAAxXYXZlc0xvdHRvVjIJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IEAAAABHJhbmQJAADL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AAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBgkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24JAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgYGL5He7A==", "height": 1406343, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Bqg2a9kuT4GLzNY7NyDAxW9pLYjkr6wQvcByBT1n1rvp Next: BBA6ikxTzfDaKfNyKKqRpPqdEaZPNzEJ7vUoiZzWyMKS Diff:
OldNewDifferences
125125 let winningBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(1)))
126126 let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight"))
127127 let account = toBase58String(i.caller.bytes)
128- let balance = wavesBalance(this)
128+ let prize = (wavesBalance(this) - 100000)
129129 let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
130130 if ((account != DAPPOWNER))
131131 then throw("Only dAPP Owner can Close the Lottery.")
133133 then throw(("Cannot close a contest in status: " + contestCurrStatus))
134134 else if ((winningBetAccount != NONE))
135135 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)
139138 }
140139 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)])
141140 }
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)
8989 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"))
9898 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.")
109109 else if ((contestCurrStatus != RUNNING))
110110 then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus))
111111 else if (if ((0 > guessedNumber))
112112 then true
113113 else (guessedNumber > 99))
114114 then throw("You can select a number between 0 and 99")
115115 else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(guessedNumber)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))])
116116 }
117117
118118
119119
120120 @Callable(i)
121121 func closecontest () = {
122122 let rand = randomizer(i)
123123 let extractedNumber = (toInt(rand) % 2)
124124 let contestCurrNumber = getNumByKey("contest_currentnumber")
125125 let winningBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(1)))
126126 let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight"))
127127 let account = toBase58String(i.caller.bytes)
128- let balance = wavesBalance(this)
128+ let prize = (wavesBalance(this) - 100000)
129129 let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status"))
130130 if ((account != DAPPOWNER))
131131 then throw("Only dAPP Owner can Close the Lottery.")
132132 else if ((contestCurrStatus != RUNNING))
133133 then throw(("Cannot close a contest in status: " + contestCurrStatus))
134134 else if ((winningBetAccount != NONE))
135135 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)
139138 }
140139 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)])
141140 }
142141
143142
144143 @Verifier(tx)
145144 func verify () = match tx {
146145 case _: SetScriptTransaction|DataTransaction =>
147146 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
148147 case _: InvokeScriptTransaction =>
149148 true
150149 case _ =>
151150 true
152151 }
153152

github/deemru/w8io/026f985 
36.70 ms