tx · 7obcaRZQW8VdVGVUP8Nt51F6MBEbVWGTfauVj2B7eTyk 3Mr1FdiZzG9iTQUtPmQEs1hBVbyQhG6LU93: -0.01500000 Waves 2021.08.04 10:00 [1643258] smart account 3Mr1FdiZzG9iTQUtPmQEs1hBVbyQhG6LU93 > SELF 0.00000000 Waves
{ "type": 13, "id": "7obcaRZQW8VdVGVUP8Nt51F6MBEbVWGTfauVj2B7eTyk", "fee": 1500000, "feeAssetId": null, "timestamp": 1628060488339, "version": 1, "sender": "3Mr1FdiZzG9iTQUtPmQEs1hBVbyQhG6LU93", "senderPublicKey": "De2GV53Brxd2GCQnLJWRugSidGtrVvPL9kJn2Dh4NTpJ", "proofs": [ "2jrB7BeBMr5vSV5wakxgLGBckmk4kW7C4XyagyTtcqnEJk1Avjew8At6LNjdYiwEqScj154qxDRwDQmSiR6jDbr8" ], "script": "base64:AAIEAAAAAAAAABQIAhIFCgMICAESAwoBCBIECgIIAgAAADUAAAAABldBVkVTRAAAAAAABfXhAAAAAAAFVVNETkQAAAAAAAAPQkAAAAAABEVHR0QAAAAAAAAAAGQAAAAACERFQ0lNQUxTCQAETAAAAAIFAAAABldBVkVTRAkABEwAAAACBQAAAAVVU0RORAkABEwAAAACBQAAAARFR0dEBQAAAANuaWwAAAAABkFTU0VUUwkABEwAAAACBQAAAAR1bml0CQAETAAAAAIJAAJZAAAAAQIAAAAsMjVGRXFFalJrcUs2eUNraVQ3THo2U0FZejdnVUZDdHhmQ0NobnJWRkQ1QVQJAARMAAAAAgkAAlkAAAABAgAAACxIc0V3V3V1UWpVb2hyWDI2Rng4dGc1ZWlMNExERDd1bTZqcU5xRmdFUng2ZwUAAAADbmlsAAAAAAtCRVRESVZJREVSUwkABEwAAAACAAAAAAAAAAABCQAETAAAAAIAAAAAAAAAAAEJAARMAAAAAgAAAAAAAAAAZAUAAAADbmlsAAAAAAtNSU5GRUVXQVZFUwkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAABldBVkVTRAAAAA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AHYXNzZXRJZAkAAGcAAAACCQAAZQAAAAIJAQAAAA9nZXRBc3NldEJhbGFuY2UAAAABCAUAAAADdHR4AAAAB2Fzc2V0SWQIBQAAAAN0dHgAAAAGYW1vdW50CQEAAAAIZ2V0SW50T3IAAAACCQABkQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZBQAAAAdhc3NldElkAAAAAAAAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwAwMJAAAAAAAAAgkBAAAACGdldEludE9yAAAAAgkAAZEAAAACBQAAAA5SRVNFUlZBVElPTktFWQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAACCQEAAAAIZ2V0SW50T3IAAAACCQABkQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAABwkAAAAAAAACCQEAAAAIZ2V0SW50T3IAAAACCQABkQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAABwcHznGw8Q==", "chainId": 84, "height": 1643258, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C337qM2FryZMoZHj5SBNSixKtewfmsVc2xBCG5Y5nMmz Next: 921cQV3NjtRLNtq8Kk3UT62X4wYWgD7kq2Kwxmn4VRbD Diff:
Old | New | Differences | |
---|---|---|---|
53 | 53 | ||
54 | 54 | let IdxAssetId = 5 | |
55 | 55 | ||
56 | - | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN"] | |
56 | + | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN", "$RESERVED_AMOUNT_EGG"] | |
57 | 57 | ||
58 | 58 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
59 | 59 | ||
215 | 215 | ||
216 | 216 | ||
217 | 217 | @Callable(i) | |
218 | + | func constructor (rsaPublic64,benzAddress,randOracleTimeFrame) = if ((addressFromPublicKey(i.callerPublicKey) != this)) | |
219 | + | then throw("not authorized") | |
220 | + | else [StringEntry(RSAPUBLIC64KEY, rsaPublic64), StringEntry(SERVERADDRESSKEY, benzAddress), IntegerEntry(RANDTIMEFRAMEKEY, randOracleTimeFrame)] | |
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | @Callable(i) | |
218 | 225 | func bet (playerChoice) = { | |
219 | 226 | let gameId = toBase58String(i.transactionId) | |
220 | 227 | if ((1 >= size(i.payments))) | |
279 | 286 | let assetId = validateAndGetAssetId(ttx.assetId) | |
280 | 287 | ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(RESERVATIONKEY[assetId], 0)) | |
281 | 288 | case stx: SetScriptTransaction => | |
282 | - | if ((getIntOr(RESERVATIONKEY[0], 0) == 0)) | |
289 | + | if (if ((getIntOr(RESERVATIONKEY[0], 0) == 0)) | |
283 | 290 | then (getIntOr(RESERVATIONKEY[1], 0) == 0) | |
291 | + | else false) | |
292 | + | then (getIntOr(RESERVATIONKEY[2], 0) == 0) | |
284 | 293 | else false | |
285 | 294 | case _ => | |
286 | 295 | false |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WAVESD = 100000000 | |
5 | 5 | ||
6 | 6 | let USDND = 1000000 | |
7 | 7 | ||
8 | 8 | let EGGD = 100 | |
9 | 9 | ||
10 | 10 | let DECIMALS = [WAVESD, USDND, EGGD] | |
11 | 11 | ||
12 | 12 | let ASSETS = [unit, fromBase58String("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT"), fromBase58String("HsEwWuuQjUohrX26Fx8tg5eiL4LDD7um6jqNqFgERx6g")] | |
13 | 13 | ||
14 | 14 | let BETDIVIDERS = [1, 1, 100] | |
15 | 15 | ||
16 | 16 | let MINFEEWAVES = ((5 * WAVESD) / 1000) | |
17 | 17 | ||
18 | 18 | let BET1 = 1 | |
19 | 19 | ||
20 | 20 | let BET2 = 2 | |
21 | 21 | ||
22 | 22 | let BET4 = 4 | |
23 | 23 | ||
24 | 24 | let BET8 = 8 | |
25 | 25 | ||
26 | 26 | let BET14 = 14 | |
27 | 27 | ||
28 | 28 | let RATEMULT = 10000 | |
29 | 29 | ||
30 | 30 | let RATE1 = 39655 | |
31 | 31 | ||
32 | 32 | let RATE2 = 24600 | |
33 | 33 | ||
34 | 34 | let RATE3 = 19000 | |
35 | 35 | ||
36 | 36 | let RATE4 = 14200 | |
37 | 37 | ||
38 | 38 | let RATE5 = 11400 | |
39 | 39 | ||
40 | 40 | let RATES = [RATE1, RATE2, RATE3, RATE4, RATE5] | |
41 | 41 | ||
42 | 42 | let BETS = [BET1, BET2, BET4, BET8, BET14] | |
43 | 43 | ||
44 | 44 | let IdxGameState = 0 | |
45 | 45 | ||
46 | 46 | let IdxPlayerChoice = 1 | |
47 | 47 | ||
48 | 48 | let IdxPlayerPubKey58 = 2 | |
49 | 49 | ||
50 | 50 | let IdxStartedHeight = 3 | |
51 | 51 | ||
52 | 52 | let IdxWinAmount = 4 | |
53 | 53 | ||
54 | 54 | let IdxAssetId = 5 | |
55 | 55 | ||
56 | - | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN"] | |
56 | + | let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN", "$RESERVED_AMOUNT_EGG"] | |
57 | 57 | ||
58 | 58 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
59 | 59 | ||
60 | 60 | let RSAPUBLIC64KEY = "$RSA_PUBLIC64" | |
61 | 61 | ||
62 | 62 | let SERVERADDRESSKEY = "$BENZ_ADDRESS" | |
63 | 63 | ||
64 | 64 | let RANDTIMEFRAMEKEY = "$RAND_ORACLE_TIMEFRAME" | |
65 | 65 | ||
66 | 66 | let STATESUBMITTED = "SUBMITTED" | |
67 | 67 | ||
68 | 68 | let STATEWON = "WON" | |
69 | 69 | ||
70 | 70 | let STATELOST = "LOST" | |
71 | 71 | ||
72 | 72 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " key is not specified in this.state")) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | let RSAPUBLIC = fromBase64String(getStringOrFail(RSAPUBLIC64KEY)) | |
76 | 76 | ||
77 | 77 | let SERVER = addressFromStringValue(getStringOrFail(SERVERADDRESSKEY)) | |
78 | 78 | ||
79 | 79 | let RANDORACLETIMEFRAME = valueOrElse(getInteger(this, RANDTIMEFRAMEKEY), 7200) | |
80 | 80 | ||
81 | 81 | func getIntOr (key,default) = if (isDefined(getInteger(this, key))) | |
82 | 82 | then getIntegerValue(this, key) | |
83 | 83 | else default | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func setInt (key,value) = IntegerEntry(key, value) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1)) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by)) | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func getAssetBalance (assetIdOrUnit) = match assetIdOrUnit { | |
96 | 96 | case assetId: ByteVector => | |
97 | 97 | assetBalance(this, assetId) | |
98 | 98 | case _ => | |
99 | 99 | wavesBalance(this).available | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func increaseReserveAmount (winAmount,assetId) = { | |
104 | 104 | let newReservedAmount = (getIntOr(RESERVATIONKEY[assetId], 0) + winAmount) | |
105 | 105 | if ((newReservedAmount > getAssetBalance(ASSETS[assetId]))) | |
106 | 106 | then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.") | |
107 | 107 | else newReservedAmount | |
108 | 108 | } | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func decreaseReservedAmount (gameId,assetId,winAmount) = if ((0 > (getIntOr(RESERVATIONKEY[assetId], 0) - winAmount))) | |
112 | 112 | then throw("Invalid Dice Roller account state - reserved amount is less than 0") | |
113 | 113 | else changeInt(RESERVATIONKEY[assetId], -(winAmount)) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func validateAndGetAssetId (assetId) = if ((assetId == ASSETS[0])) | |
117 | 117 | then 0 | |
118 | 118 | else if ((assetId == ASSETS[1])) | |
119 | 119 | then 1 | |
120 | 120 | else if ((assetId == ASSETS[2])) | |
121 | 121 | then 2 | |
122 | 122 | else throw("Invalid payment asset") | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func validateBetAndGetWinAmount (bet,internalAssetId,playerChoice) = { | |
126 | 126 | let dicesCount = size(playerChoice) | |
127 | 127 | func checkAmount (a,x) = if (a) | |
128 | 128 | then true | |
129 | 129 | else (bet == ((x * DECIMALS[internalAssetId]) / BETDIVIDERS[internalAssetId])) | |
130 | 130 | ||
131 | 131 | if (!({ | |
132 | 132 | let $l = BETS | |
133 | 133 | let $s = size($l) | |
134 | 134 | let $acc0 = false | |
135 | 135 | func 1 ($a,$i) = if (($i >= $s)) | |
136 | 136 | then $a | |
137 | 137 | else checkAmount($a, $l[$i]) | |
138 | 138 | ||
139 | 139 | func 2 ($a,$i) = if (($i >= $s)) | |
140 | 140 | then $a | |
141 | 141 | else throw("List size exceeds 5") | |
142 | 142 | ||
143 | 143 | 2(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5) | |
144 | 144 | })) | |
145 | 145 | then throw("Bet amount is not valid") | |
146 | 146 | else if ((parseInt(playerChoice) == unit)) | |
147 | 147 | then throw("Invalid player's choice") | |
148 | 148 | else if (if ((1 > dicesCount)) | |
149 | 149 | then true | |
150 | 150 | else (dicesCount > 5)) | |
151 | 151 | then throw("Invalid dices count in player's choice") | |
152 | 152 | else ((bet * RATES[(dicesCount - 1)]) / RATEMULT) | |
153 | 153 | } | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func generateRandChoise (gameId,rsaSign) = { | |
157 | 157 | let rsaSigValid = rsaVerify_16Kb(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
158 | 158 | if (!(rsaSigValid)) | |
159 | 159 | then throw("Invalid RSA signature") | |
160 | 160 | else { | |
161 | 161 | let rand = (toInt(sha256(rsaSign)) % 6) | |
162 | 162 | let result = if ((0 > rand)) | |
163 | 163 | then (-1 * rand) | |
164 | 164 | else rand | |
165 | 165 | toString((result + 1)) | |
166 | 166 | } | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func isPlayerWin (playerChoice,randChoise) = { | |
171 | 171 | let s = size(playerChoice) | |
172 | 172 | func check (a,x) = if (a) | |
173 | 173 | then true | |
174 | 174 | else if ((s >= x)) | |
175 | 175 | then (take(drop(playerChoice, (x - 1)), 1) == randChoise) | |
176 | 176 | else false | |
177 | 177 | ||
178 | 178 | let $l = [1, 2, 3, 4, 5] | |
179 | 179 | let $s = size($l) | |
180 | 180 | let $acc0 = false | |
181 | 181 | func 1 ($a,$i) = if (($i >= $s)) | |
182 | 182 | then $a | |
183 | 183 | else check($a, $l[$i]) | |
184 | 184 | ||
185 | 185 | func 2 ($a,$i) = if (($i >= $s)) | |
186 | 186 | then $a | |
187 | 187 | else throw("List size exceeds 5") | |
188 | 188 | ||
189 | 189 | 2(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5) | |
190 | 190 | } | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | func formatGameDataS (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetId,randOrEmpty) = makeString([gameStatus, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, if ((randOrEmpty == "")) | |
194 | 194 | then "" | |
195 | 195 | else ("_" + randOrEmpty)], "_") | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func formatGameData (gameStatus,playerChoice,playerPubKey58,startedHeight,winAmount,assetId,randOrEmpty) = formatGameDataS(gameStatus, playerChoice, playerPubKey58, toString(startedHeight), toString(winAmount), toString(assetId), randOrEmpty) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func finishGameData (origGameData,gameStatus,rand,winByTimeout) = { | |
202 | 202 | let finishGameData = formatGameDataS(gameStatus, origGameData[IdxPlayerChoice], origGameData[IdxPlayerPubKey58], origGameData[IdxStartedHeight], origGameData[IdxWinAmount], origGameData[IdxAssetId], rand) | |
203 | 203 | if (winByTimeout) | |
204 | 204 | then (finishGameData + "_TIMEOUT") | |
205 | 205 | else finishGameData | |
206 | 206 | } | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | func extractGameData (gameId) = split(match getString(this, gameId) { | |
210 | 210 | case str: String => | |
211 | 211 | str | |
212 | 212 | case _ => | |
213 | 213 | throw((("Game: " + gameId) + " not found.")) | |
214 | 214 | }, "_") | |
215 | 215 | ||
216 | 216 | ||
217 | 217 | @Callable(i) | |
218 | + | func constructor (rsaPublic64,benzAddress,randOracleTimeFrame) = if ((addressFromPublicKey(i.callerPublicKey) != this)) | |
219 | + | then throw("not authorized") | |
220 | + | else [StringEntry(RSAPUBLIC64KEY, rsaPublic64), StringEntry(SERVERADDRESSKEY, benzAddress), IntegerEntry(RANDTIMEFRAMEKEY, randOracleTimeFrame)] | |
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | @Callable(i) | |
218 | 225 | func bet (playerChoice) = { | |
219 | 226 | let gameId = toBase58String(i.transactionId) | |
220 | 227 | if ((1 >= size(i.payments))) | |
221 | 228 | then throw("2 payments must be attached") | |
222 | 229 | else if (isDefined(getString(this, gameId))) | |
223 | 230 | then throw((("Bet for: " + gameId) + " was already made.")) | |
224 | 231 | else { | |
225 | 232 | let betPmt = value(i.payments[0]) | |
226 | 233 | let feePmt = value(i.payments[1]) | |
227 | 234 | if (isDefined(feePmt.assetId)) | |
228 | 235 | then throw("feePmt (2nd payment) assetId must be in Waves") | |
229 | 236 | else if ((MINFEEWAVES > feePmt.amount)) | |
230 | 237 | then throw("feePmt (2nd payment) must be >= 0.005 Waves") | |
231 | 238 | else { | |
232 | 239 | let internalAssetId = validateAndGetAssetId(betPmt.assetId) | |
233 | 240 | let commission = feePmt.amount | |
234 | 241 | let winAmount = validateBetAndGetWinAmount(betPmt.amount, internalAssetId, playerChoice) | |
235 | 242 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
236 | 243 | let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, internalAssetId, "") | |
237 | 244 | [IntegerEntry(RESERVATIONKEY[internalAssetId], increaseReserveAmount(winAmount, internalAssetId)), incrementInt(GAMESCOUNTERKEY), StringEntry(gameId, gameData), ScriptTransfer(SERVER, commission, feePmt.assetId)] | |
238 | 245 | } | |
239 | 246 | } | |
240 | 247 | } | |
241 | 248 | ||
242 | 249 | ||
243 | 250 | ||
244 | 251 | @Callable(i) | |
245 | 252 | func withdraw (gameId,rsaSign) = { | |
246 | 253 | let gameData = extractGameData(gameId) | |
247 | 254 | let gameState = gameData[IdxGameState] | |
248 | 255 | let playerChoice = gameData[IdxPlayerChoice] | |
249 | 256 | let startedHeight = parseIntValue(gameData[IdxStartedHeight]) | |
250 | 257 | let winAmount = parseIntValue(gameData[IdxWinAmount]) | |
251 | 258 | let assetId = parseIntValue(gameData[IdxAssetId]) | |
252 | 259 | let playerPubKey58 = gameData[IdxPlayerPubKey58] | |
253 | 260 | let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58)) | |
254 | 261 | if ((gameState != STATESUBMITTED)) | |
255 | 262 | then throw("Invalid game state for passed gameId") | |
256 | 263 | else if ((i.caller != SERVER)) | |
257 | 264 | then throw("Regular withdraw can be done by server only") | |
258 | 265 | else { | |
259 | 266 | let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME) | |
260 | 267 | let randChoise = if (winByTimeout) | |
261 | 268 | then take(playerChoice, 1) | |
262 | 269 | else generateRandChoise(gameId, rsaSign) | |
263 | 270 | let playerWin = isPlayerWin(playerChoice, randChoise) | |
264 | 271 | let newGameStatus = if (playerWin) | |
265 | 272 | then STATEWON | |
266 | 273 | else STATELOST | |
267 | 274 | let newGameData = finishGameData(gameData, newGameStatus, randChoise, winByTimeout) | |
268 | 275 | ([StringEntry(gameId, newGameData), decreaseReservedAmount(gameId, assetId, winAmount)] ++ (if (playerWin) | |
269 | 276 | then [ScriptTransfer(playerAddress, winAmount, ASSETS[assetId])] | |
270 | 277 | else nil)) | |
271 | 278 | } | |
272 | 279 | } | |
273 | 280 | ||
274 | 281 | ||
275 | 282 | @Verifier(tx) | |
276 | 283 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
277 | 284 | then match tx { | |
278 | 285 | case ttx: TransferTransaction => | |
279 | 286 | let assetId = validateAndGetAssetId(ttx.assetId) | |
280 | 287 | ((getAssetBalance(ttx.assetId) - ttx.amount) >= getIntOr(RESERVATIONKEY[assetId], 0)) | |
281 | 288 | case stx: SetScriptTransaction => | |
282 | - | if ((getIntOr(RESERVATIONKEY[0], 0) == 0)) | |
289 | + | if (if ((getIntOr(RESERVATIONKEY[0], 0) == 0)) | |
283 | 290 | then (getIntOr(RESERVATIONKEY[1], 0) == 0) | |
291 | + | else false) | |
292 | + | then (getIntOr(RESERVATIONKEY[2], 0) == 0) | |
284 | 293 | else false | |
285 | 294 | case _ => | |
286 | 295 | false | |
287 | 296 | } | |
288 | 297 | else false | |
289 | 298 |
github/deemru/w8io/169f3d6 53.44 ms ◑