tx · DgCWijSpoAFS8NGmBJxgoKp5FJf7Wo94aRqwbNzbk7Hf

3N386AaAQ34s3Ga3Vwvj7jZT4n5RMZ2D87L:  -0.01500000 Waves

2020.06.11 11:16 [1038494] smart account 3N386AaAQ34s3Ga3Vwvj7jZT4n5RMZ2D87L > SELF 0.00000000 Waves

{ "type": 13, "id": "DgCWijSpoAFS8NGmBJxgoKp5FJf7Wo94aRqwbNzbk7Hf", "fee": 1500000, "feeAssetId": null, "timestamp": 1591863415528, "version": 1, "sender": "3N386AaAQ34s3Ga3Vwvj7jZT4n5RMZ2D87L", "senderPublicKey": "13zfYm3UK8VLtAkdfjwiTxSfcwYWruPy96mLSByVg3Xq", "proofs": [ "4RGxME9RJ14hrPFC6kzRk6K1XsPkjTqFaH6gBy6A17rJtKbNqmQ2iiV814sXgwFPFH3wfX59T7oyGz5Ez1gQKAKH" ], "script": "base64:AAIDAAAAAAAAAA0IARIDCgEIEgQKAggCAAAASAAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQW1wdVhjSS9vNHBJQjV5d3Y5RE9PR2FwVEJVd1JWbE0vNitINmhGZWxPWHRrcndZL1lJdG1QeEVEcHo3ckFlclFQUWU5dERQRWFBdi9HbmxFenR5Yk9GWGd1OUR6RGU4WW9NUkQxdmFrZ29BY29nbWJZNThRRDZLTWo1SGtvVmoveVROSWM5c3pqNXFoSWxyQWRtYjNLTEw2aFFVN3k4K0pqNjlCV1ZQc2FRZ2tzcFNkZVl0YjF0SFFjN3Q5NW43T1o1NnIyQTdHMytiUWY2blNNa1BrQWhJckVwYkNtNThvaUdCY3pkVGQvTHFGU1ZvdFpzYkw3WWg2U0hMZm5IZUQrUWdjZkpybmFtOE9ITUdKRUpUUlhqSUxlSEdqbFJDUDhvVnBpb0hyeTFTMnhQeDVzVnpJbTJNTStDelllbkFHbG8wajI2YXRCaGlVTG9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TZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwAwkAAAAAAAACCQEAAAAIZ2V0SW50T3IAAAACCQABkQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAIJAQAAAAhnZXRJbnRPcgAAAAIJAAGRAAAAAgUAAAAOUkVTRVJWQVRJT05LRVkAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAHBwfBtZz9", "chainId": 84, "height": 1038494, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmpuXcI/o4pIB5ywv9DOOGapTBUwRVlM/6+H6hFelOXtkrwY/YItmPxEDpz7rAerQPQe9tDPEaAv/GnlEztybOFXgu9DzDe8YoMRD1vakgoAcogmbY58QD6KMj5HkoVj/yTNIc9szj5qhIlrAdmb3KLL6hQU7y8+Jj69BWVPsaQgkspSdeYtb1tHQc7t95n7OZ56r2A7G3+bQf6nSMkPkAhIrEpbCm58oiGBczdTd/LqFSVotZsbL7Yh6SHLfnHeD+QgcfJrnam8OHMGJEJTRXjILeHGjlRCP8oVpioHry1S2xPx5sVzIm2MM+CzYenAGlo0j26atBhiULoTulwD3pQIDAQAB")
5+
6+let SERVER = addressFromStringValue("3NCiG28LmWyTigWG13E5QnvdHBsZFYXSS2j")
7+
8+let RANDORACLETIMEFRAME = 4320
9+
10+let WAVESD = 100000000
11+
12+let USDND = 1000000
13+
14+let DECIMALS = [WAVESD, USDND]
15+
16+let ASSETS = [unit, fromBase58String("25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT")]
17+
18+let COMMISSION = [((5 * WAVESD) / 1000), (((5 * USDND) / 1000) * 10)]
19+
20+func getCommission (assetId) = COMMISSION[assetId]
21+
22+
23+func getBetMin (assetId) = ((1 * DECIMALS[assetId]) / 2)
24+
25+
26+func getBetMax (assetId) = (6 * DECIMALS[assetId])
27+
28+
29+func getBetStep (assetId) = ((1 * DECIMALS[assetId]) / 10)
30+
31+
32+func getIntOr (key,default) = if (isDefined(getInteger(this, key)))
33+ then getIntegerValue(this, key)
34+ else default
35+
36+
37+func setInt (key,value) = DataEntry(key, value)
38+
39+
40+func incrementInt (key) = setInt(key, (getIntOr(key, -1) + 1))
41+
42+
43+func changeInt (key,by) = setInt(key, (getIntOr(key, 0) + by))
44+
45+
46+let PRECISION = 10000
47+
48+let R1MAX = 96
49+
50+let R1MIN = 94
51+
52+let R1K = 9860
53+
54+let R2MAX = 93
55+
56+let R2MIN = 87
57+
58+let R2K = 9800
59+
60+let R3MAX = 86
61+
62+let R3MIN = 86
63+
64+let R3K = 9750
65+
66+let R4MAX = 85
67+
68+let R4MIN = 84
69+
70+let R4K = 9670
71+
72+let R5MAX = 83
73+
74+let R5MIN = 83
75+
76+let R5K = 9630
77+
78+let R6MAX = 82
79+
80+let R6MIN = 67
81+
82+let R6K = 9610
83+
84+let R7MAX = 66
85+
86+let R7MIN = 56
87+
88+let R7K = 9560
89+
90+let R8MAX = 55
91+
92+let R8MIN = 38
93+
94+let R8K = 9500
95+
96+let R9MAX = 37
97+
98+let R9MIN = 3
99+
100+let R9K = 9290
101+
102+let R10MAX = 2
103+
104+let R10MIN = 1
105+
106+let R10K = 9860
107+
108+let IdxGameState = 0
109+
110+let IdxPlayerChoice = 1
111+
112+let IdxPlayerPubKey58 = 2
113+
114+let IdxStartedHeight = 3
115+
116+let IdxWinAmount = 4
117+
118+let IdxAssetId = 5
119+
120+let RESERVATIONKEY = ["$RESERVED_AMOUNT_WAVES", "$RESERVED_AMOUNT_USDN"]
121+
122+let GAMESCOUNTERKEY = "$GAME_NUM"
123+
124+let MAXBALANCEKEY = "$MAX_BALANCE"
125+
126+let STATESUBMITTED = "SUBMITTED"
127+
128+let STATEWON = "WON"
129+
130+let STATELOST = "LOST"
131+
132+func incrementGameNum () = {
133+ let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
134+ case num: Int =>
135+ num
136+ case _ =>
137+ 0
138+ }
139+ (gameNum + 1)
140+ }
141+
142+
143+func extractReservedAmount (assetId) = match getInteger(this, RESERVATIONKEY[assetId]) {
144+ case a: Int =>
145+ a
146+ case _ =>
147+ 0
148+}
149+
150+
151+func increaseReserveAmount (winAmount,assetId) = {
152+ let newReservedAmount = (getIntOr(RESERVATIONKEY[assetId], 0) + winAmount)
153+ if ((newReservedAmount > assetBalance(this, ASSETS[assetId])))
154+ then throw("Insufficient funds on Dice Roller account. Transaction was rejected for your safety.")
155+ else newReservedAmount
156+ }
157+
158+
159+func decreaseReservedAmount (gameId,assetId,winAmount) = if ((0 > (getIntOr(RESERVATIONKEY[assetId], 0) - winAmount)))
160+ then throw("Invalid Dice Roller account state - reserved amount is less than 0")
161+ else changeInt(RESERVATIONKEY[assetId], -(winAmount))
162+
163+
164+func validateAndGetAssetId (assetId) = if ((assetId == ASSETS[0]))
165+ then 0
166+ else if ((assetId == ASSETS[1]))
167+ then 1
168+ else throw("Invalid payment asset")
169+
170+
171+func validateBetAndGetWinAmount (bet,assetId,playerChoice) = {
172+ let BETMIN = getBetMin(assetId)
173+ let BETMAX = getBetMax(assetId)
174+ let BETSTEP = getBetStep(assetId)
175+ let betAmountValid = if (if ((bet >= BETMIN))
176+ then (BETMAX >= bet)
177+ else false)
178+ then ((bet % BETSTEP) == 0)
179+ else false
180+ if (betAmountValid)
181+ then {
182+ let playerChoiceInt = parseIntValue(playerChoice)
183+ if (if ((playerChoiceInt >= 1))
184+ then (96 >= playerChoiceInt)
185+ else false)
186+ then {
187+ let RKxPrecision = if (if ((R1MAX >= playerChoiceInt))
188+ then (playerChoiceInt >= R1MIN)
189+ else false)
190+ then R1K
191+ else if (if ((R2MAX >= playerChoiceInt))
192+ then (playerChoiceInt >= R2MIN)
193+ else false)
194+ then R2K
195+ else if (if ((R3MAX >= playerChoiceInt))
196+ then (playerChoiceInt >= R3MIN)
197+ else false)
198+ then R3K
199+ else if (if ((R4MAX >= playerChoiceInt))
200+ then (playerChoiceInt >= R4MIN)
201+ else false)
202+ then R4K
203+ else if (if ((R5MAX >= playerChoiceInt))
204+ then (playerChoiceInt >= R5MIN)
205+ else false)
206+ then R5K
207+ else if (if ((R6MAX >= playerChoiceInt))
208+ then (playerChoiceInt >= R6MIN)
209+ else false)
210+ then R6K
211+ else if (if ((R7MAX >= playerChoiceInt))
212+ then (playerChoiceInt >= R7MIN)
213+ else false)
214+ then R7K
215+ else if (if ((R8MAX >= playerChoiceInt))
216+ then (playerChoiceInt >= R8MIN)
217+ else false)
218+ then R8K
219+ else if (if ((R9MAX >= playerChoiceInt))
220+ then (playerChoiceInt >= R9MIN)
221+ else false)
222+ then R9K
223+ else if (if ((R10MAX >= playerChoiceInt))
224+ then (playerChoiceInt >= R10MIN)
225+ else false)
226+ then R10K
227+ else throw(("Couldn't define range: playerChoice=" + playerChoice))
228+ ((((100 * RKxPrecision) / playerChoiceInt) * bet) / PRECISION)
229+ }
230+ else throw("Player choice is out of the condition below: 1 <= choice <= 96")
231+ }
232+ else throw(((((("Bet amount is not in range: minBet=" + toString(BETMIN)) + " maxBet=") + toString(BETMAX)) + " betStep=") + toString(BETSTEP)))
233+ }
234+
235+
236+func randToStr (r) = if (if ((r >= 1))
237+ then (100 >= r)
238+ else false)
239+ then toString(r)
240+ else throw(("Unsupported r parameter passed: expected=[1,...,100] actual=" + toString(r)))
241+
242+
243+func generateRandInt (gameId,rsaSign) = {
244+ let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC)
245+ if (rsaSigValid)
246+ then {
247+ let rand = (toInt(sha256(rsaSign)) % 100)
248+ if ((0 > rand))
249+ then ((-1 * rand) + 1)
250+ else (rand + 1)
251+ }
252+ else throw("Invalid RSA signature")
253+ }
254+
255+
256+func isPlayerWin (playerChoice,rand) = {
257+ let playerChoiceInt = parseIntValue(playerChoice)
258+ (playerChoiceInt >= rand)
259+ }
260+
261+
262+func formatGameDataParam (p) = {
263+ let s = size(p)
264+ if ((s == 0))
265+ then throw("Parameter size must be greater then 0")
266+ else if ((s > 99))
267+ then throw("Parameter size must be less then 100")
268+ else if ((10 > s))
269+ then (("0" + toString(s)) + p)
270+ else (toString(s) + p)
271+ }
272+
273+
274+func formatGameData (gameState,playerChoice,playerPubKey58,startedHeight,winAmount,assetId,randOrEmpty) = (((((((((((gameState + "_") + playerChoice) + "_") + playerPubKey58) + "_") + toString(startedHeight)) + "_") + toString(winAmount)) + "_") + toString(assetId)) + (if ((randOrEmpty == ""))
275+ then ""
276+ else ("_" + randOrEmpty)))
277+
278+
279+func extractGameData (gameId) = split(match getString(this, gameId) {
280+ case str: String =>
281+ str
282+ case _ =>
283+ throw((("Game: " + gameId) + " not found."))
284+}, "_")
285+
286+
287+func winScriptSet (gameId,playerAddress,winAmount,assetId,newGameDataStr,winByTimeout,decreasedReserves) = {
288+ let wSetCommonData = [decreasedReserves]
289+ let tSetCommonData = [ScriptTransfer(playerAddress, winAmount, ASSETS[assetId])]
290+ if (winByTimeout)
291+ then {
292+ let newGameDataStrAdjusted = (newGameDataStr + "_TIMEOUT")
293+ let gameData = DataEntry(gameId, newGameDataStrAdjusted)
294+ ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
295+ }
296+ else {
297+ let gameData = DataEntry(gameId, newGameDataStr)
298+ ScriptResult(WriteSet(gameData :: wSetCommonData), TransferSet(tSetCommonData))
299+ }
300+ }
301+
302+
303+@Callable(i)
304+func bet (playerChoice) = {
305+ let gameId = toBase58String(i.transactionId)
306+ if ((i.payment == unit))
307+ then throw("No payment")
308+ else if (isDefined(getString(this, gameId)))
309+ then throw((("Bet for: " + gameId) + " was already made."))
310+ else if (if ((i.feeAssetId != ASSETS[0]))
311+ then (i.feeAssetId != ASSETS[1])
312+ else false)
313+ then throw("Invalid fee")
314+ else {
315+ let p = extract(i.payment)
316+ if ((i.feeAssetId != p.assetId))
317+ then throw("Fee assetId and payment assetId should match")
318+ else {
319+ let assetId = validateAndGetAssetId(p.assetId)
320+ let commission = getCommission(assetId)
321+ let winAmount = validateBetAndGetWinAmount((p.amount - i.fee), assetId, playerChoice)
322+ let playerPubKey58 = toBase58String(i.callerPublicKey)
323+ let gameData = formatGameData(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmount, assetId, "")
324+ ScriptResult(WriteSet([DataEntry(RESERVATIONKEY[assetId], increaseReserveAmount(winAmount, assetId)), incrementInt(GAMESCOUNTERKEY), DataEntry(gameId, gameData)]), TransferSet([ScriptTransfer(SERVER, commission, p.assetId)]))
325+ }
326+ }
327+ }
328+
329+
330+
331+@Callable(i)
332+func withdraw (gameId,rsaSign) = {
333+ let gameData = extractGameData(gameId)
334+ let gameState = gameData[IdxGameState]
335+ let playerChoice = gameData[IdxPlayerChoice]
336+ let startedHeight = parseIntValue(gameData[IdxStartedHeight])
337+ let winAmount = parseIntValue(gameData[IdxWinAmount])
338+ let assetId = parseIntValue(gameData[IdxAssetId])
339+ let playerPubKey58 = gameData[IdxPlayerPubKey58]
340+ let playerAddress = addressFromPublicKey(fromBase58String(playerPubKey58))
341+ let winByTimeout = ((height - startedHeight) > RANDORACLETIMEFRAME)
342+ let decreasedReserves = decreaseReservedAmount(gameId, assetId, winAmount)
343+ if ((gameState != STATESUBMITTED))
344+ then throw("Invalid game state for passed gameId")
345+ else if (winByTimeout)
346+ then {
347+ let randStr = playerChoice
348+ let newGameDataStr = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randStr)
349+ winScriptSet(gameId, playerAddress, winAmount, assetId, newGameDataStr, winByTimeout, decreasedReserves)
350+ }
351+ else {
352+ let rand = generateRandInt(gameId, rsaSign)
353+ let randStr = randToStr(rand)
354+ if (isPlayerWin(playerChoice, rand))
355+ then {
356+ let newGameDataStr = formatGameData(STATEWON, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randStr)
357+ winScriptSet(gameId, playerAddress, winAmount, assetId, newGameDataStr, winByTimeout, decreasedReserves)
358+ }
359+ else {
360+ let newGameDataStr = formatGameData(STATELOST, playerChoice, playerPubKey58, startedHeight, winAmount, assetId, randStr)
361+ WriteSet([DataEntry(gameId, newGameDataStr), decreasedReserves])
362+ }
363+ }
364+ }
365+
366+
367+@Verifier(tx)
368+func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
369+ then match tx {
370+ case ttx: TransferTransaction =>
371+ let assetId = validateAndGetAssetId(ttx.assetId)
372+ ((assetBalance(this, ttx.assetId) - ttx.amount) >= getIntOr(RESERVATIONKEY[assetId], 0))
373+ case stx: SetScriptTransaction =>
374+ if ((getIntOr(RESERVATIONKEY[0], 0) == 0))
375+ then (getIntOr(RESERVATIONKEY[1], 0) == 0)
376+ else false
377+ case _ =>
378+ false
379+ }
380+ else false
381+

github/deemru/w8io/026f985 
23.42 ms