tx · FZaVVwuudjyPinYPnh2twVyVoL6EezfDWF72xkYXN69a 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89: -0.01400000 Waves 2019.08.21 09:43 [640535] smart account 3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89 > SELF 0.00000000 Waves
{ "type": 13, "id": "FZaVVwuudjyPinYPnh2twVyVoL6EezfDWF72xkYXN69a", "fee": 1400000, "feeAssetId": null, "timestamp": 1566369779177, "version": 1, "sender": "3MsGBnTzBhrNe6w1KpLYPkzdDdxWudm4U89", "senderPublicKey": "FgbqvGasMMrXxbhwrsgEiCgJLjXPjgn8kHxsZiVmLrkb", "proofs": [ "46MnVQEFEfwPwwN4SnzZ65viTxy2NRVJFdjvmVgUoCZWNP7iTnAVhJCVfMuPcQv1jk9baTcxwVgSi1UrMLhY4V2o" ], "script": "base64:AAIDAAAAAAAAAAAAAAAgAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbGVtcjk1SjFqWlVzN2NKbXJtbWxONHpvN1lWc0JKekllSmRrOExERkdoVUtTSTZ5ZnMyMFp5SmUyMSs2R0p3Tm5LVVUxVXlvYzE3d1NXTUtrclowTU12WUUrWjVBaWlqdkJLNHNTSjNJZ0dqZFU4L05oSThDQkR1MEYreFJNOXEzVEIzTExiRHk1c0JkdWRZZkhmc1VPYytNVHZBRDY5bjI3ZGIyUmg4K3laUU10dWJrdVRRTnA4OXNwaEhRYUxHeVFGYU5sSy9OYTNsRng2b21xemFhMWdqb3BsVXI2cnZZS2dmQUlDVUIzelZtSlNoaUVpN3c3UjBoV2xOUkQzcWNaakNVT05TcEZvNFdiemtuR09henc4NEIrSU1JRm5JcFhXelFMOFJYMHZOY2ZzQnZMRGZNNmsyWmFjcXd5TUthTExxaWdkQmlHZEo3VyswbE9TdE9RSURBUUFCAAAAABNSQU5ET1JBQ0xFVEl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WlnaHQFAAAABndpbkFtdAIAAAAABAAAAAZTRVJWRVIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQQAAAAOc2VydmVyVHJhbnNmZXIJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAGU0VSVkVSBQAAAApDT01NSVNTSU9OBQAAAAR1bml0BQAAAANuaWwEAAAAB2JldERhdGEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADlJFU0VSVkFUSU9OS0VZCQEAAAAeVmFsaWRhdGVBbmRJbmNyZWFzZVJlc2VydmVkQW10AAAAAQUAAAAGd2luQW10CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA9HQU1FU0NPVU5URVJLRVkFAAAACm5ld0dhbWVOdW0JAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABmdhbWVJZAUAAAALZ2FtZURhdGFTdHIFAAAAA25pbAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEFAAAAB2JldERhdGEJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAADnNlcnZlclRyYW5zZmVyAAAAAGr4Mxw=", "chainId": 84, "height": 640535, "spentComplexity": 0 } View: original | compacted Prev: SdbTsCAiPk8fsrHpmZBw4vnWT7PuWxbpYu8kK1Ysxim Next: 9fSDAxX9uypZWBcdkeJiMqx9H49oNpTh6qKtpk91ZN3F Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let WAVELET = ((100 * 1000) * 1000) | |
9 | 9 | ||
10 | - | let COMMISSION = (( | |
10 | + | let COMMISSION = ((9 * WAVELET) / 1000) | |
11 | 11 | ||
12 | 12 | let BET1 = (1 * WAVELET) | |
13 | 13 |
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 | - | let COMMISSION = (( | |
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 | 164 | if ((bulletsCount == 5)) | |
165 | 165 | then ((bet * RATE1) / RATEMULT) | |
166 | 166 | else if ((bulletsCount == 4)) | |
167 | 167 | then ((bet * RATE2) / RATEMULT) | |
168 | 168 | else if ((bulletsCount == 3)) | |
169 | 169 | then ((bet * RATE3) / RATEMULT) | |
170 | 170 | else if ((bulletsCount == 2)) | |
171 | 171 | then ((bet * RATE4) / RATEMULT) | |
172 | 172 | else if ((bulletsCount == 1)) | |
173 | 173 | then ((bet * RATE5) / RATEMULT) | |
174 | 174 | else throw("Invalid bullets in player's choice") | |
175 | 175 | } | |
176 | 176 | else throw("Bet amount is not in range") | |
177 | 177 | } | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | @Callable(i) | |
181 | 181 | func bet (playerChoice) = { | |
182 | 182 | let newGameNum = IncrementGameNum() | |
183 | 183 | let gameId = toBase58String(i.transactionId) | |
184 | 184 | let pmt = extract(i.payment) | |
185 | 185 | let betNotInWaves = isDefined(pmt.assetId) | |
186 | 186 | let feeNotInWaves = isDefined(pmt.assetId) | |
187 | 187 | let winAmt = ValidateBetAndDefineWinAmt(pmt.amount, playerChoice) | |
188 | 188 | let txIdUsed = isDefined(getString(this, gameId)) | |
189 | 189 | if (betNotInWaves) | |
190 | 190 | then throw("Bet amount must be in Waves") | |
191 | 191 | else if (feeNotInWaves) | |
192 | 192 | then throw("Transaction's fee must be in Waves") | |
193 | 193 | else if (txIdUsed) | |
194 | 194 | then throw("Passed txId had been used before. Game aborted.") | |
195 | 195 | else { | |
196 | 196 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
197 | 197 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, playerChoice, playerPubKey58, height, winAmt, "") | |
198 | 198 | let SERVER = addressFromPublicKey(i.callerPublicKey) | |
199 | 199 | let serverTransfer = [ScriptTransfer(SERVER, COMMISSION, unit)] | |
200 | 200 | let betData = [DataEntry(RESERVATIONKEY, ValidateAndIncreaseReservedAmt(winAmt)), DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)] | |
201 | 201 | ScriptResult(WriteSet(betData), TransferSet(serverTransfer)) | |
202 | 202 | } | |
203 | 203 | } | |
204 | 204 | ||
205 | 205 |
github/deemru/w8io/026f985 31.86 ms ◑