tx · 9fSDAxX9uypZWBcdkeJiMqx9H49oNpTh6qKtpk91ZN3F 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89: -0.01400000 Waves 2019.08.21 10:04 [640555] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves
{ "type": 13, "id": "9fSDAxX9uypZWBcdkeJiMqx9H49oNpTh6qKtpk91ZN3F", "fee": 1400000, "feeAssetId": null, "timestamp": 1566371046971, "version": 1, "sender": "3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89", "senderPublicKey": "FgbqvGasMMrXxbhwrsgEiCgJLjXPjgn8kHxsZiVmLrkb", "proofs": [ "4RbPrLM1EAo9b2VPFpB67FDv24pfRfNnLgEdTAV1Yzauyrz4dNgpeAxS8uY8KehV2uPEk22rTvoQbJ3hE5eRbAkN" ], "script": "base64:AAIDAAAAAAAAAAAAAAAgAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbGVtcjk1SjFqWlVzN2NKbXJtbWxONHpvN1lWc0JKekllSmRrOExERkdoVUtTSTZ5ZnMyMFp5SmUyMSs2R0p3Tm5LVVUxVXlvYzE3d1NXTUtrclowTU12WUUrWjVBaWlqdkJLNHNTSjNJZ0dqZFU4L05oSThDQkR1MEYreFJNOXEzVEIzTExiRHk1c0JkdWRZZkhmc1VPYytNVHZBRDY5bjI3ZGIyUmg4K3laUU10dWJrdVRRTnA4OXNwaEhRYUxHeVFGYU5sSy9OYTNsRng2b21xemFhMWdqb3BsVXI2cnZZS2dmQUlDVUIzelZtSlNoaUVpN3c3UjBoV2xOUkQzcWNaakNVT05TcEZvNFdiemtuR09henc4NEIrSU1JRm5JcFhXelFMOFJYMHZOY2ZzQnZMRGZNNmsyWmFjcXd5TUthTExxaWdkQmlHZEo3VyswbE9TdE9RSURBUUFCAAAAABNSQU5ET1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RhRW50cnkAAAACBQAAAA5SRVNFUlZBVElPTktFWQkBAAAAHlZhbGlkYXRlQW5kSW5jcmVhc2VSZXNlcnZlZEFtdAAAAAEFAAAABndpbkFtdAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAPR0FNRVNDT1VOVEVSS0VZBQAAAApuZXdHYW1lTnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZnYW1lSWQFAAAAC2dhbWVEYXRhU3RyBQAAAANuaWwJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABBQAAAAdiZXREYXRhCQEAAAALVHJhbnNmZXJTZXQAAAABBQAAAA5zZXJ2ZXJUcmFuc2ZlcgAAAAC7IgHd", "chainId": 84, "height": 640555, "spentComplexity": 0 } View: original | compacted Prev: FZaVVwuudjyPinYPnh2twVyVoL6EezfDWF72xkYXN69a Next: 8AxSmR2Z9mNtWDTiBxyVrgiuhWMgzRKE6qducZbTjJmx Diff:
Old | New | Differences | |
---|---|---|---|
161 | 161 | then { | |
162 | 162 | let bulletsCount = size(playerChoice) | |
163 | 163 | let bet = (betAmt - COMMISSION) | |
164 | - | if ((bulletsCount == 5)) | |
164 | + | let b1 = parseIntValue(take(playerChoice, 1)) | |
165 | + | let forB2 = drop(playerChoice, 1) | |
166 | + | let b2 = parseIntValue(take(forB2, 1)) | |
167 | + | let forB3 = drop(playerChoice, 1) | |
168 | + | let b3 = parseIntValue(take(forB3, 1)) | |
169 | + | let forB4 = drop(playerChoice, 1) | |
170 | + | let b4 = parseIntValue(take(forB4, 1)) | |
171 | + | let forB5 = drop(playerChoice, 1) | |
172 | + | let b5 = parseIntValue(take(forB5, 1)) | |
173 | + | let activeBullets = ((((b1 + b2) + b3) + b4) + b5) | |
174 | + | if ((activeBullets == 5)) | |
165 | 175 | then ((bet * RATE1) / RATEMULT) | |
166 | - | else if (( | |
176 | + | else if ((activeBullets == 4)) | |
167 | 177 | then ((bet * RATE2) / RATEMULT) | |
168 | - | else if (( | |
178 | + | else if ((activeBullets == 3)) | |
169 | 179 | then ((bet * RATE3) / RATEMULT) | |
170 | - | else if (( | |
180 | + | else if ((activeBullets == 2)) | |
171 | 181 | then ((bet * RATE4) / RATEMULT) | |
172 | - | else if (( | |
182 | + | else if ((activeBullets == 1)) | |
173 | 183 | then ((bet * RATE5) / RATEMULT) | |
174 | - | else throw("Invalid | |
184 | + | else throw("Invalid player's choice") | |
175 | 185 | } | |
176 | 186 | else throw("Bet amount is not in range") | |
177 | 187 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlemr95J1jZUs7cJmrmmlN4zo7YVsBJzIeJdk8LDFGhUKSI6yfs20ZyJe21+6GJwNnKUU1Uyoc17wSWMKkrZ0MMvYE+Z5AiijvBK4sSJ3IgGjdU8/NhI8CBDu0F+xRM9q3TB3LLbDy5sBdudYfHfsUOc+MTvAD69n27db2Rh8+yZQMtubkuTQNp89sphHQaLGyQFaNlK/Na3lFx6omqzaa1gjoplUr6rvYKgfAICUB3zVmJShiEi7w7R0hWlNRD3qcZjCUONSpFo4WbzknGOazw84B+IMIFnIpXWzQL8RX0vNcfsBvLDfM6k2ZacqwyMKaLLqigdBiGdJ7W+0lOStOQIDAQAB") | |
5 | 5 | ||
6 | 6 | let RANDORACLETIMEFRAME = 4320 | |
7 | 7 | ||
8 | 8 | let WAVELET = ((100 * 1000) * 1000) | |
9 | 9 | ||
10 | 10 | let COMMISSION = ((9 * WAVELET) / 1000) | |
11 | 11 | ||
12 | 12 | let BET1 = (1 * WAVELET) | |
13 | 13 | ||
14 | 14 | let BET2 = (2 * WAVELET) | |
15 | 15 | ||
16 | 16 | let BET4 = (4 * WAVELET) | |
17 | 17 | ||
18 | 18 | let BET8 = (8 * WAVELET) | |
19 | 19 | ||
20 | 20 | let BET14 = (14 * WAVELET) | |
21 | 21 | ||
22 | 22 | let RATEMULT = 10000 | |
23 | 23 | ||
24 | 24 | let RATE1 = 39655 | |
25 | 25 | ||
26 | 26 | let RATE2 = 24600 | |
27 | 27 | ||
28 | 28 | let RATE3 = 19000 | |
29 | 29 | ||
30 | 30 | let RATE4 = 14200 | |
31 | 31 | ||
32 | 32 | let RATE5 = 11400 | |
33 | 33 | ||
34 | 34 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
35 | 35 | ||
36 | 36 | let RESERVATIONKEY = "$RESERVED_AMOUNT" | |
37 | 37 | ||
38 | 38 | let STATESUBMITTED = "SUBMITTED" | |
39 | 39 | ||
40 | 40 | let STATEWON = "WON" | |
41 | 41 | ||
42 | 42 | let STATELOST = "LOST" | |
43 | 43 | ||
44 | 44 | func getAnswer (playerChoice) = BET14 | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func GenerateRandInt (gameId,rsaSign) = { | |
48 | 48 | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
49 | 49 | if (rsaSigValid) | |
50 | 50 | then { | |
51 | 51 | let rand = (toInt(sha256(rsaSign)) % 6) | |
52 | 52 | if ((0 > rand)) | |
53 | 53 | then (-1 * rand) | |
54 | 54 | else rand | |
55 | 55 | } | |
56 | 56 | else throw("Invalid RSA signature") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
61 | 61 | then drop(remaining, 1) | |
62 | 62 | else remaining | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func ParseNextAttribute (remaining) = { | |
66 | 66 | let s = size(remaining) | |
67 | 67 | if ((s > 0)) | |
68 | 68 | then { | |
69 | 69 | let nn = parseIntValue(take(remaining, 2)) | |
70 | 70 | let v = take(drop(remaining, 2), nn) | |
71 | 71 | let tmpRemaining = drop(remaining, (nn + 2)) | |
72 | 72 | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
73 | 73 | [v, remainingState] | |
74 | 74 | } | |
75 | 75 | else throw("Empty string was passed into parseNextAttribute func") | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func ParseGameRawDataStr (rawStateStr) = { | |
80 | 80 | let gameState = ParseNextAttribute(rawStateStr) | |
81 | 81 | let playerChoice = ParseNextAttribute(gameState[1]) | |
82 | 82 | let playerPubKey58 = ParseNextAttribute(playerChoice[1]) | |
83 | 83 | let startedHeight = ParseNextAttribute(playerPubKey58[1]) | |
84 | 84 | let winAmt = ParseNextAttribute(startedHeight[1]) | |
85 | 85 | [gameState[0], playerChoice[0], playerPubKey58[0], startedHeight[0], winAmt[0]] | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func ExtractGameDataList (gameId) = { | |
90 | 90 | let rawDataStr = match getString(this, gameId) { | |
91 | 91 | case str: String => | |
92 | 92 | str | |
93 | 93 | case _ => | |
94 | 94 | throw(("Couldn't find game by " + gameId)) | |
95 | 95 | } | |
96 | 96 | ParseGameRawDataStr(rawDataStr) | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func ExtractReservedAmt () = match getInteger(this, RESERVATIONKEY) { | |
101 | 101 | case a: Int => | |
102 | 102 | a | |
103 | 103 | case _ => | |
104 | 104 | 0 | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func ValidateAndIncreaseReservedAmt (winAmt) = { | |
109 | 109 | let newReservedAmount = (ExtractReservedAmt() + winAmt) | |
110 | 110 | let balance = wavesBalance(this) | |
111 | 111 | if ((newReservedAmount > balance)) | |
112 | 112 | then throw("Insufficient funds on Russian Roulette account. Transaction was rejected for your safety.") | |
113 | 113 | else newReservedAmount | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func IncrementGameNum () = { | |
118 | 118 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
119 | 119 | case num: Int => | |
120 | 120 | num | |
121 | 121 | case _ => | |
122 | 122 | 0 | |
123 | 123 | } | |
124 | 124 | (gameNum + 1) | |
125 | 125 | } | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func FormatGameDataParam (p) = { | |
129 | 129 | let s = size(p) | |
130 | 130 | if ((s == 0)) | |
131 | 131 | then throw("Parameter size must be greater then 0") | |
132 | 132 | else if ((s > 99)) | |
133 | 133 | then throw("Parameter size must be less then 100") | |
134 | 134 | else if ((10 > s)) | |
135 | 135 | then (("0" + toString(s)) + p) | |
136 | 136 | else (toString(s) + p) | |
137 | 137 | } | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func FormatGameDataStr (gameState,playerChoice,playerPubKey58,startedHeight,winAmt,randOrEmpty) = { | |
141 | 141 | let fullStateStr = ((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerChoice)) + "_") + FormatGameDataParam(playerPubKey58)) + "_") + FormatGameDataParam(toString(startedHeight))) + "_") + FormatGameDataParam(toString(winAmt))) | |
142 | 142 | if ((randOrEmpty == "")) | |
143 | 143 | then fullStateStr | |
144 | 144 | else ((fullStateStr + "_") + FormatGameDataParam(randOrEmpty)) | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func ValidateBetAndDefineWinAmt (betAmt,playerChoice) = { | |
149 | 149 | let betAmtValid = if (if (if (if (if ((betAmt == (BET1 + COMMISSION))) | |
150 | 150 | then true | |
151 | 151 | else (betAmt == (BET2 + COMMISSION))) | |
152 | 152 | then true | |
153 | 153 | else (betAmt == (BET4 + COMMISSION))) | |
154 | 154 | then true | |
155 | 155 | else (betAmt == (BET8 + COMMISSION))) | |
156 | 156 | then true | |
157 | 157 | else (betAmt == (BET14 + COMMISSION))) | |
158 | 158 | then true | |
159 | 159 | else false | |
160 | 160 | if (betAmtValid) | |
161 | 161 | then { | |
162 | 162 | let bulletsCount = size(playerChoice) | |
163 | 163 | let bet = (betAmt - COMMISSION) | |
164 | - | if ((bulletsCount == 5)) | |
164 | + | let b1 = parseIntValue(take(playerChoice, 1)) | |
165 | + | let forB2 = drop(playerChoice, 1) | |
166 | + | let b2 = parseIntValue(take(forB2, 1)) | |
167 | + | let forB3 = drop(playerChoice, 1) | |
168 | + | let b3 = parseIntValue(take(forB3, 1)) | |
169 | + | let forB4 = drop(playerChoice, 1) | |
170 | + | let b4 = parseIntValue(take(forB4, 1)) | |
171 | + | let forB5 = drop(playerChoice, 1) | |
172 | + | let b5 = parseIntValue(take(forB5, 1)) | |
173 | + | let activeBullets = ((((b1 + b2) + b3) + b4) + b5) | |
174 | + | if ((activeBullets == 5)) | |
165 | 175 | then ((bet * RATE1) / RATEMULT) | |
166 | - | else if (( | |
176 | + | else if ((activeBullets == 4)) | |
167 | 177 | then ((bet * RATE2) / RATEMULT) | |
168 | - | else if (( | |
178 | + | else if ((activeBullets == 3)) | |
169 | 179 | then ((bet * RATE3) / RATEMULT) | |
170 | - | else if (( | |
180 | + | else if ((activeBullets == 2)) | |
171 | 181 | then ((bet * RATE4) / RATEMULT) | |
172 | - | else if (( | |
182 | + | else if ((activeBullets == 1)) | |
173 | 183 | then ((bet * RATE5) / RATEMULT) | |
174 | - | else throw("Invalid | |
184 | + | else throw("Invalid player's choice") | |
175 | 185 | } | |
176 | 186 | else throw("Bet amount is not in range") | |
177 | 187 | } | |
178 | 188 | ||
179 | 189 | ||
180 | 190 | @Callable(i) | |
181 | 191 | func bet (playerChoice) = { | |
182 | 192 | let newGameNum = IncrementGameNum() | |
183 | 193 | let gameId = toBase58String(i.transactionId) | |
184 | 194 | let pmt = extract(i.payment) | |
185 | 195 | let betNotInWaves = isDefined(pmt.assetId) | |
186 | 196 | let feeNotInWaves = isDefined(pmt.assetId) | |
187 | 197 | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
188 | 198 | let txIdUsed = isDefined(getString(this, gameId)) | |
189 | 199 | if (betNotInWaves) | |
190 | 200 | then throw("Bet amount must be in Waves") | |
191 | 201 | else if (feeNotInWaves) | |
192 | 202 | then throw("Transaction's fee must be in Waves") | |
193 | 203 | else if (txIdUsed) | |
194 | 204 | then throw("Passed txId had been used before. Game aborted.") | |
195 | 205 | else { | |
196 | 206 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
197 | 207 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
198 | 208 | let SERVER = addressFromPublicKey(i.callerPublicKey) | |
199 | 209 | let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)] | |
200 | 210 | let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)] | |
201 | 211 | ScriptResult(WriteSet(betData), TransferSet(serverTransfer)) | |
202 | 212 | } | |
203 | 213 | } | |
204 | 214 | ||
205 | 215 |
github/deemru/w8io/026f985 54.77 ms ◑