tx · DhFEayuE5j9FP4AxLqBrmaaC7dnDSpU8hPUecYz59b6m

3Mwuu6do9zBghKKVshUFferCwepiQYcAeVE:  -0.01500000 Waves

2019.07.12 11:09 [582243] smart account 3Mwuu6do9zBghKKVshUFferCwepiQYcAeVE > SELF 0.00000000 Waves

{ "type": 13, "id": "DhFEayuE5j9FP4AxLqBrmaaC7dnDSpU8hPUecYz59b6m", "fee": 1500000, "feeAssetId": null, "timestamp": 1562918981178, "version": 1, "sender": "3Mwuu6do9zBghKKVshUFferCwepiQYcAeVE", "senderPublicKey": "8fdATo5z3B5EweA3kKoRgbJZhGa4JicyHHMkhBZTvNSf", "proofs": [ "4E29nC2tVwqPSc5gimi3MVbh6zzvMKCxbdCWdNwyQLd25VBvsmKrafR2PWnuGAprEr9hcZebMty6BtghLdWAtF2j" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAVXYXZlcwAAAAAABfXhAAAAAAAEYmV0MQkAAGgAAAACAAAAAAAAAAABBQAAAAVXYXZlcwAAAAAEYmV0NQkAAGgAAAACAAAAAAAAAAAFBQAAAAVXYXZlcwAAAAAFYmV0MTAJAABoAAAAAgAAAAAAAAAACgUAAAAFV2F2ZXMAAAAABWJldDI1CQAAaAAAAAIAAAAAAAAAABkFAAAABVdhdmVzAAAAAAZiZXQxMDAJAABoAAAAAgAAAAAAAAAAZAUAAAAFV2F2ZXMAAAAACWNvbWlzc2lvbgAAAAAAAExLQAAAAAAPb3JhY2xlUHVibGljS2V5CQACWQAAAAECAAAALEE3N3FwVmt0enQxb0FQeVBmbUtkUHNEWkdSUEp6QnJFM1dUdHVMMUt4TVlMAAAAAA1nYW1lVGltZUZyYW1lAAAAAAAAAAWgAAAAAAhzdGF0ZUFjYwIAAAAIQWNjZXB0ZWQAAAAACHN0YXRlV2luAgAAAANXaW4AAAAADHN0YXRlVGltZW91dAIAAAAMV2luQnlUaW1lb3V0AAAAAAlzdGF0ZUxvc2UCAAAABExvc2UAAAACAAAAAWkBAAAAA2Jld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ABYQAAAAAAAAAAAAQAAAAQYXZhaWxhYmxlQmFsYW5jZQkAAGUAAAACCQEAAAAMd2F2ZXNCYWxhbmNlAAAAAQUAAAAEdGhpcwUAAAAPcmVzZXJ2ZWRCYWxhbmNlBAAAAA9hdmFpbGlibGVBbW91bnQJAABnAAAAAgUAAAAQYXZhaWxhYmxlQmFsYW5jZQgFAAAAA3R0eAAAAAZhbW91bnQEAAAACXNpZ25hdHVyZQkAAfQAAAADCAUAAAADdHR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAADdHR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAA3R0eAAAAA9zZW5kZXJQdWJsaWNLZXkDBQAAAA9hdmFpbGlibGVBbW91bnQFAAAACXNpZ25hdHVyZQcDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAARzc3R4BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAARzc3R4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAAEc3N0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAARzc3R4AAAAD3NlbmRlclB1YmxpY0tleQcTrGHv", "chainId": 84, "height": 582243, "spentComplexity": 0 } View: original | compacted Prev: 9KTapyJLaNDEyyvVz9Mv52MYtkDyMK41GLgnwmHAwytw Next: GaYZTuzs3UhNTx4HES5bG8wEVkZ9Qg8ikQQxLUXQta8a Diff:
OldNewDifferences
169169
170170
171171 @Verifier(tx)
172-func verify () = true
172+func verify () = match tx {
173+ case ttx: TransferTransaction =>
174+ let valueReservedBalance = getInteger(this, "Reserved")
175+ let reservedBalance = match valueReservedBalance {
176+ case a: Int =>
177+ a
178+ case _ =>
179+ 0
180+ }
181+ let availableBalance = (wavesBalance(this) - reservedBalance)
182+ let availibleAmount = (availableBalance >= ttx.amount)
183+ let signature = sigVerify(ttx.bodyBytes, ttx.proofs[0], ttx.senderPublicKey)
184+ if (availibleAmount)
185+ then signature
186+ else false
187+ case sstx: SetScriptTransaction =>
188+ sigVerify(sstx.bodyBytes, sstx.proofs[0], sstx.senderPublicKey)
189+ case _ =>
190+ false
191+}
173192
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let Waves = 100000000
55
66 let bet1 = (1 * Waves)
77
88 let bet5 = (5 * Waves)
99
1010 let bet10 = (10 * Waves)
1111
1212 let bet25 = (25 * Waves)
1313
1414 let bet100 = (100 * Waves)
1515
1616 let comission = 5000000
1717
1818 let oraclePublicKey = fromBase58String("A77qpVktzt1oAPyPfmKdPsDZGRPJzBrE3WTtuL1KxMYL")
1919
2020 let gameTimeFrame = 1440
2121
2222 let stateAcc = "Accepted"
2323
2424 let stateWin = "Win"
2525
2626 let stateTimeout = "WinByTimeout"
2727
2828 let stateLose = "Lose"
2929
3030 @Callable(i)
3131 func bet (choice) = {
3232 let pmnt = extract(i.payment)
3333 let gameId = toBase58String(i.transactionId)
3434 let gameStart = height
3535 let gameCounter = {
3636 let gameNumber = {
3737 let counterValue = getInteger(this, "GamesCounter")
3838 match counterValue {
3939 case p: Int =>
4040 p
4141 case _ =>
4242 0
4343 }
4444 }
4545 (gameNumber + 1)
4646 }
4747 let betAssetIdCheck = isDefined(pmnt.assetId)
4848 let playerPublicKey = toBase58String(i.callerPublicKey)
4949 let playerChoice = if (if ((choice == "1"))
5050 then true
5151 else (choice == "2"))
5252 then choice
5353 else throw("Player's choice is incorrect")
5454 let playerPrize = {
5555 let bet = (pmnt.amount - comission)
5656 if (if (if (if (if ((bet == bet1))
5757 then true
5858 else (bet == bet5))
5959 then true
6060 else (bet == bet10))
6161 then true
6262 else (bet == bet25))
6363 then true
6464 else (bet == bet100))
6565 then (bet * 2)
6666 else throw("Payment amount is incorrect")
6767 }
6868 let reservedBalance = {
6969 let currentReservedBalance = {
7070 let valueReservedBalance = getInteger(this, "Reserved")
7171 match valueReservedBalance {
7272 case a: Int =>
7373 a
7474 case _ =>
7575 0
7676 }
7777 }
7878 let newReservedBalance = (currentReservedBalance + playerPrize)
7979 if ((wavesBalance(this) >= newReservedBalance))
8080 then {
8181 let increaseReservedBalance = newReservedBalance
8282 increaseReservedBalance
8383 }
8484 else throw("Bet was rejected. Insufficient funds on game account.")
8585 }
8686 if (betAssetIdCheck)
8787 then throw("You can make bet in Waves only")
8888 else {
8989 let dataString = ((((((((stateAcc + "_") + playerPublicKey) + "_") + playerChoice) + "_") + toString(playerPrize)) + "_") + toString(gameStart))
9090 WriteSet([DataEntry("Reserved", reservedBalance), DataEntry(gameId, dataString)])
9191 }
9292 }
9393
9494
9595
9696 @Callable(i)
9797 func withdraw (gameId,rsaSign) = {
9898 let dataList = {
9999 let getDataString = getString(this, gameId)
100100 let a = match getDataString {
101101 case a: String =>
102102 a
103103 case _ =>
104104 throw("GameId was not found")
105105 }
106106 split(a, "_")
107107 }
108108 let gameState = dataList[0]
109109 let playerAddress = {
110110 let a = dataList[1]
111111 addressFromPublicKey(fromBase58String(a))
112112 }
113113 let playerChoice = dataList[2]
114114 let rsaToInt = {
115115 let rsaCheck = rsaVerify(SHA256, toBytes(gameId), rsaSign, oraclePublicKey)
116116 if (rsaCheck)
117117 then {
118118 let rsaInt = ((toInt(sha256(rsaSign)) % 99) + 1)
119119 if (if ((rsaInt > 0))
120120 then (100 >= rsaInt)
121121 else false)
122122 then rsaInt
123123 else throw("Rsa integer is not in range")
124124 }
125125 else throw("Rsa Signature is invalid")
126126 }
127127 let gameStart = {
128128 let a = dataList[4]
129129 parseIntValue(a)
130130 }
131131 let playerPrize = {
132132 let a = dataList[3]
133133 parseIntValue(a)
134134 }
135135 let newReservedBalance = {
136136 let valueReservedBalance = getInteger(this, "Reserved")
137137 let extractReservedBalance = match valueReservedBalance {
138138 case a: Int =>
139139 a
140140 case _ =>
141141 0
142142 }
143143 let decreaseReservedBalance = (extractReservedBalance - playerPrize)
144144 if ((decreaseReservedBalance > 0))
145145 then decreaseReservedBalance
146146 else throw("Reserved balance couldn't be less than 0")
147147 }
148148 let stringForNewData = ((((((dataList[1] + "_") + dataList[2]) + "_") + dataList[3]) + "_") + dataList[4])
149149 let gameTime = (gameTimeFrame > (height - gameStart))
150150 let stateCheck = (gameState == stateAcc)
151151 if (stateCheck)
152152 then if (gameTime)
153153 then {
154154 let playerWin = {
155155 let rsaToState = if ((48 > rsaToInt))
156156 then "1"
157157 else if ((rsaToInt > 52))
158158 then "2"
159159 else "3"
160160 (rsaToState == playerChoice)
161161 }
162162 if (playerWin)
163163 then ScriptResult(WriteSet([DataEntry(gameId, ((((stateWin + "_") + stringForNewData) + "_") + toString(rsaToInt))), DataEntry("Reserved", newReservedBalance)]), TransferSet([ScriptTransfer(playerAddress, playerPrize, unit)]))
164164 else WriteSet([DataEntry(gameId, ((((stateLose + "_") + stringForNewData) + "_") + toString(rsaToInt))), DataEntry("Reserved", newReservedBalance)])
165165 }
166166 else throw("Game state is invalid")
167167 else ScriptResult(WriteSet([DataEntry(gameId, ((((stateTimeout + "_") + stringForNewData) + "_") + "00")), DataEntry("Reserved", newReservedBalance)]), TransferSet([ScriptTransfer(playerAddress, playerPrize, unit)]))
168168 }
169169
170170
171171 @Verifier(tx)
172-func verify () = true
172+func verify () = match tx {
173+ case ttx: TransferTransaction =>
174+ let valueReservedBalance = getInteger(this, "Reserved")
175+ let reservedBalance = match valueReservedBalance {
176+ case a: Int =>
177+ a
178+ case _ =>
179+ 0
180+ }
181+ let availableBalance = (wavesBalance(this) - reservedBalance)
182+ let availibleAmount = (availableBalance >= ttx.amount)
183+ let signature = sigVerify(ttx.bodyBytes, ttx.proofs[0], ttx.senderPublicKey)
184+ if (availibleAmount)
185+ then signature
186+ else false
187+ case sstx: SetScriptTransaction =>
188+ sigVerify(sstx.bodyBytes, sstx.proofs[0], sstx.senderPublicKey)
189+ case _ =>
190+ false
191+}
173192

github/deemru/w8io/169f3d6 
44.65 ms