tx · Fg8oQ4q4sPcH5BBnaa4FaNrULnPCVT3Bw4at8oc1Gsys 3MtKQXaiKQxSTRPpa8GjJ5zE7mE992eBrGu: -0.05000000 Waves 2019.11.03 08:41 [748299] smart account 3MtKQXaiKQxSTRPpa8GjJ5zE7mE992eBrGu > SELF 0.00000000 Waves
{ "type": 13, "id": "Fg8oQ4q4sPcH5BBnaa4FaNrULnPCVT3Bw4at8oc1Gsys", "fee": 5000000, "feeAssetId": null, "timestamp": 1572758271068, "version": 1, "sender": "3MtKQXaiKQxSTRPpa8GjJ5zE7mE992eBrGu", "senderPublicKey": "2vmjFmSn7wGYrffwrNFgTN6j9CATDKwa8t8KAXWe2HVW", "proofs": [ "3jvRXNrkTpcE1kEbeKDpmH2bN3CsnTcxfD1UtGFz81B2SRnvoQ5Cr6rvRq8RTd2T7SxKNiLaceKKzMbfbwPpwCLG" ], "script": "base64:AAIDAAAAAAAAABIIARIDCgEIEgQKAggCEgMKAQgAAAAkAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBZzRkQVI2WGJCREFTOWhyL0VqM2RKdjZGZmM0NjZ4L21PR01XVTNsckFCczNxYThCSG11Skdua2ZicEVmMnZBd1lUT1dQdnZ6Zk0xME9CYmZsb1N5cTNjOU1LdnlUZTFsdUJMR3FXNHZaVVhJeXZTZ3oxbGl5VVZlZklReTNkeUY5amJlVFpiQzBiYmNULzdPM0RFTCswMXo2QStyRENhY1NaMGxHb2xTUTZBbmhMeHpJa1ZwT1FKYnJCbUMreCtadVpQQ01Xekp5bmQ1YWVPbjdqYWovbWtSVnl4ZTZnLzBPaFd6NE5paVpYZXVNUkIrOG1LeTBmV0QvVWxJbFpXSHNBUzJabXJrWEtxakxxMC8wd3I4SUxKa3pualNxZG5JNUliamczdVFyai80QU4raTlyMjhhUTczL1prUHRZNVNidzBBT2lBQkJ1N2dIbXE5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AQAAAALcmVmdW5kVG9rZW4JAQAAAAl0b2tlblR5cGUAAAABBQAAAAdwYXlUeXBlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAGZ2FtZUlkBQAAAA5uZXdHYW1lRGF0YVN0cgUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADldBTExFVFdBVkVTQkVUCQAAawAAAAMFAAAABnBheUFtdAUAAAALRkVFV0FWRVNCRVQAAAAAAAAAAGQFAAAAC3JlZnVuZFRva2VuCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADFdBTExFVE1DQUZFRQkAAGsAAAADBQAAAAZwYXlBbXQFAAAACUZFRU1DQUZFRQAAAAAAAAAAZAUAAAALcmVmdW5kVG9rZW4JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMcmVmdW5kV2FsbGV0BQAAAAlyZWZ1bmRBbXQFAAAAC3JlZnVuZFRva2VuBQAAAANuaWwAAAAACSFt6g==", "chainId": 84, "height": 748299, "spentComplexity": 0 } View: original | compacted Prev: 29Jmy7JNfZcWC67oKqX6wmsXopSUpM9pK9a1STDxk1Ku Next: HB2bEKCqab8CHMfAPSSgGubf9suDK7M22WG9ebbp7DSX Diff:
Old | New | Differences | |
---|---|---|---|
261 | 261 | let refundAmt = fraction(payAmt, ((100 - FEEWAVESBET) - FEEMCAFEE), 100) | |
262 | 262 | let refundWallet = addressFromPublicKey(fromBase58String(paPubKey58)) | |
263 | 263 | let refundToken = tokenType(payType) | |
264 | - | ScriptResult(WriteSet([DataEntry(gameId, newGameDataStr)]), TransferSet([ScriptTransfer(refundWallet, refundAmt, refundToken)])) | |
264 | + | ScriptResult(WriteSet([DataEntry(gameId, newGameDataStr)]), TransferSet([ScriptTransfer(WALLETWAVESBET, fraction(payAmt, FEEWAVESBET, 100), refundToken), ScriptTransfer(WALLETMCAFEE, fraction(payAmt, FEEMCAFEE, 100), refundToken), ScriptTransfer(refundWallet, refundAmt, refundToken)])) | |
265 | 265 | } | |
266 | 266 | } | |
267 | 267 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | 5 | ||
6 | 6 | let GAMESCOUNTERKEY = "$GAME_NUM" | |
7 | 7 | ||
8 | 8 | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
9 | 9 | ||
10 | 10 | let WALLETWAVESBET = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
11 | 11 | ||
12 | 12 | let WALLETMCAFEE = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
13 | 13 | ||
14 | 14 | let FEEWAVESBET = 4 | |
15 | 15 | ||
16 | 16 | let FEEMCAFEE = 2 | |
17 | 17 | ||
18 | 18 | let WAVELET = 100000000 | |
19 | 19 | ||
20 | 20 | let STATESUBMITTED = "SUBMITTED" | |
21 | 21 | ||
22 | 22 | let STATEACCEPTED = "ACCEPTED" | |
23 | 23 | ||
24 | 24 | let STATEFINISHED = "FINISHED" | |
25 | 25 | ||
26 | 26 | let STATECANCELED = "CANCELED" | |
27 | 27 | ||
28 | 28 | let COINRED = "RED" | |
29 | 29 | ||
30 | 30 | let COINBLUE = "BLUE" | |
31 | 31 | ||
32 | 32 | let BETMINWAVES = ((1 * WAVELET) / 4) | |
33 | 33 | ||
34 | 34 | let BETMINWBET = (100 * WAVELET) | |
35 | 35 | ||
36 | 36 | let IdxGameState = 0 | |
37 | 37 | ||
38 | 38 | let IdxPlayerACoin = 1 | |
39 | 39 | ||
40 | 40 | let IdxPlayerAPubKey58 = 2 | |
41 | 41 | ||
42 | 42 | let IdxPayType = 3 | |
43 | 43 | ||
44 | 44 | let IdxPayAmt = 4 | |
45 | 45 | ||
46 | 46 | let IdxWinAmt = 5 | |
47 | 47 | ||
48 | 48 | let IdxPlayerBCoin = 6 | |
49 | 49 | ||
50 | 50 | let IdxPlayerBPubKey58 = 7 | |
51 | 51 | ||
52 | 52 | let IdxLuckyCoin = 8 | |
53 | 53 | ||
54 | 54 | func IncrementGameNum () = { | |
55 | 55 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
56 | 56 | case num: Int => | |
57 | 57 | num | |
58 | 58 | case _ => | |
59 | 59 | 0 | |
60 | 60 | } | |
61 | 61 | (gameNum + 1) | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func GenerateRandInt (gameId,rsaSign) = { | |
66 | 66 | let rsaSigValid = rsaVerify(SHA256, toBytes(gameId), rsaSign, RSAPUBLIC) | |
67 | 67 | if (rsaSigValid) | |
68 | 68 | then { | |
69 | 69 | let rand = (toInt(sha256(rsaSign)) % 100) | |
70 | 70 | if ((0 > rand)) | |
71 | 71 | then ((-1 * rand) + 1) | |
72 | 72 | else (rand + 1) | |
73 | 73 | } | |
74 | 74 | else throw("Invalid RSA signature") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func paymentType (payment) = if ((payment.assetId == WBET)) | |
79 | 79 | then "WBET" | |
80 | 80 | else "WAVES" | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | func tokenType (token) = if ((token == "WBET")) | |
84 | 84 | then WBET | |
85 | 85 | else unit | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func FormatGameDataParam (p) = { | |
89 | 89 | let s = size(p) | |
90 | 90 | if ((s == 0)) | |
91 | 91 | then throw("Parameter size must be greater then 0") | |
92 | 92 | else if ((s > 99)) | |
93 | 93 | then throw("Parameter size must be less then 100") | |
94 | 94 | else if ((10 > s)) | |
95 | 95 | then (("0" + toString(s)) + p) | |
96 | 96 | else (toString(s) + p) | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func FormatGameDataStr (gameState,playerACoin,playerAPubKey58,payType,payAmount,winAmt,playerBCoin,playerBPubKey58,luckyCoin) = { | |
101 | 101 | let fullStateStr = ((((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerACoin)) + "_") + FormatGameDataParam(playerAPubKey58)) + "_") + FormatGameDataParam(payType)) + "_") + FormatGameDataParam(toString(payAmount))) + "_") + FormatGameDataParam(toString(winAmt))) | |
102 | 102 | if (if (if ((playerBCoin == "")) | |
103 | 103 | then true | |
104 | 104 | else (playerBPubKey58 == "")) | |
105 | 105 | then true | |
106 | 106 | else (luckyCoin == "")) | |
107 | 107 | then fullStateStr | |
108 | 108 | else ((((((fullStateStr + "_") + FormatGameDataParam(playerBCoin)) + "_") + FormatGameDataParam(playerBPubKey58)) + "_") + FormatGameDataParam(luckyCoin)) | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
113 | 113 | then drop(remaining, 1) | |
114 | 114 | else remaining | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func ParseNextAttribute (remaining) = { | |
118 | 118 | let s = size(remaining) | |
119 | 119 | if ((s > 0)) | |
120 | 120 | then { | |
121 | 121 | let nn = parseIntValue(take(remaining, 2)) | |
122 | 122 | let v = take(drop(remaining, 2), nn) | |
123 | 123 | let tmpRemaining = drop(remaining, (nn + 2)) | |
124 | 124 | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
125 | 125 | [v, remainingState] | |
126 | 126 | } | |
127 | 127 | else throw("Empty string was passed into parseNextAttribute func") | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func ParseGameRawDataStr (rawStateStr) = { | |
132 | 132 | let gameState = ParseNextAttribute(rawStateStr) | |
133 | 133 | let paCoin = ParseNextAttribute(gameState[1]) | |
134 | 134 | let paPubKey58 = ParseNextAttribute(paCoin[1]) | |
135 | 135 | let payType = ParseNextAttribute(paPubKey58[1]) | |
136 | 136 | let payAmt = ParseNextAttribute(payType[1]) | |
137 | 137 | let winAmt = ParseNextAttribute(payAmt[1]) | |
138 | 138 | [gameState[0], paCoin[0], paPubKey58[0], payType[0], payAmt[0], winAmt[0]] | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func ExtractGameDataList (gameId) = { | |
143 | 143 | let rawDataStr = match getString(this, gameId) { | |
144 | 144 | case str: String => | |
145 | 145 | str | |
146 | 146 | case _ => | |
147 | 147 | throw(("Couldn't find game by " + gameId)) | |
148 | 148 | } | |
149 | 149 | ParseGameRawDataStr(rawDataStr) | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func ValidateBetAndDefineWinAmt (amount,playerCoin,paymentType) = if (if ((playerCoin != COINRED)) | |
154 | 154 | then (playerCoin != COINBLUE) | |
155 | 155 | else false) | |
156 | 156 | then throw("Invalid play, change your bet to RED or BLUE coin. Game aborted.") | |
157 | 157 | else if (if ((paymentType == "WBET")) | |
158 | 158 | then (BETMINWBET > amount) | |
159 | 159 | else false) | |
160 | 160 | then throw(("The minimum bet on Wbet is " + toString((BETMINWBET / WAVELET)))) | |
161 | 161 | else if (if ((paymentType == "WAVES")) | |
162 | 162 | then (BETMINWAVES > amount) | |
163 | 163 | else false) | |
164 | 164 | then throw(("The minimum bet on Waves is " + toString((BETMINWAVES / WAVELET)))) | |
165 | 165 | else fraction((amount * 2), ((100 - FEEWAVESBET) - FEEMCAFEE), 100) | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | @Callable(i) | |
169 | 169 | func playCoinflip (paCoin) = { | |
170 | 170 | let gameId = toBase58String(i.transactionId) | |
171 | 171 | let gameIdUsed = isDefined(getString(this, gameId)) | |
172 | 172 | let payment = extract(i.payment) | |
173 | 173 | let feeAssetId = isDefined(i.feeAssetId) | |
174 | 174 | if (if ((payment.assetId != assetInfo(base58'WAVES'))) | |
175 | 175 | then (payment.assetId != WBET) | |
176 | 176 | else false) | |
177 | 177 | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
178 | 178 | else if (feeAssetId) | |
179 | 179 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
180 | 180 | else if (gameIdUsed) | |
181 | 181 | then throw("Passed gameId had been used before. Game aborted.") | |
182 | 182 | else { | |
183 | 183 | let newGameNum = IncrementGameNum() | |
184 | 184 | let playerAPubKey58 = toBase58String(i.callerPublicKey) | |
185 | 185 | let payType = paymentType(payment) | |
186 | 186 | let winAmt = ValidateBetAndDefineWinAmt(payment.amount, paCoin, payType) | |
187 | 187 | let gameDataStr = FormatGameDataStr(STATESUBMITTED, paCoin, playerAPubKey58, payType, payment.amount, winAmt, "", "", "") | |
188 | 188 | ScriptResult(WriteSet([DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet(nil)) | |
189 | 189 | } | |
190 | 190 | } | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | ||
194 | 194 | @Callable(i) | |
195 | 195 | func acceptCoinChallenge (gameId,rsaSig) = { | |
196 | 196 | let gameDataList = ExtractGameDataList(gameId) | |
197 | 197 | let gameState = gameDataList[IdxGameState] | |
198 | 198 | let paCoin = gameDataList[IdxPlayerACoin] | |
199 | 199 | let paPubKey58 = gameDataList[IdxPlayerAPubKey58] | |
200 | 200 | let payType = gameDataList[IdxPayType] | |
201 | 201 | let payAmt = parseIntValue(gameDataList[IdxPayAmt]) | |
202 | 202 | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
203 | 203 | let payment = extract(i.payment) | |
204 | 204 | let feeAssetId = isDefined(i.feeAssetId) | |
205 | 205 | let pbPubKey58 = toBase58String(i.callerPublicKey) | |
206 | 206 | let payTypeB = paymentType(payment) | |
207 | 207 | if (if ((payment.assetId != assetInfo(base58'WAVES'))) | |
208 | 208 | then (payment.assetId != WBET) | |
209 | 209 | else false) | |
210 | 210 | then throw("Payment should be in Wbet or Waves. Game aborted.") | |
211 | 211 | else if (feeAssetId) | |
212 | 212 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
213 | 213 | else if ((paPubKey58 == pbPubKey58)) | |
214 | 214 | then throw("You can't accept a challenge created by yourself. Game aborted.") | |
215 | 215 | else if ((payType != payTypeB)) | |
216 | 216 | then throw("Payment must be made in the same token as the bet, WBET/WBET or WAVES/WAVES. Game aborted.") | |
217 | 217 | else if ((payAmt != payment.amount)) | |
218 | 218 | then throw("Payout must be equal to the challenger bet amount. Game aborted.") | |
219 | 219 | else if ((gameState != STATESUBMITTED)) | |
220 | 220 | then throw("Invalid game state for passed gameId. Game aborted.") | |
221 | 221 | else { | |
222 | 222 | let rand = GenerateRandInt(gameId, rsaSig) | |
223 | 223 | let luckyCoin = if ((rand > 50)) | |
224 | 224 | then COINRED | |
225 | 225 | else COINBLUE | |
226 | 226 | let pbCoin = if ((paCoin == COINRED)) | |
227 | 227 | then COINBLUE | |
228 | 228 | else COINRED | |
229 | 229 | let tokenAssetId = tokenType(payType) | |
230 | 230 | let newGameDataStr = FormatGameDataStr(STATEFINISHED, paCoin, paPubKey58, payType, payAmt, winAmt, pbCoin, pbPubKey58, luckyCoin) | |
231 | 231 | let winAddr = if ((paCoin == luckyCoin)) | |
232 | 232 | then addressFromPublicKey(fromBase58String(paPubKey58)) | |
233 | 233 | else i.caller | |
234 | 234 | ScriptResult(WriteSet([DataEntry(gameId, newGameDataStr)]), TransferSet([ScriptTransfer(WALLETWAVESBET, ((winAmt * FEEWAVESBET) / 100), tokenAssetId), ScriptTransfer(WALLETMCAFEE, ((winAmt * FEEWAVESBET) / 100), tokenAssetId), ScriptTransfer(winAddr, winAmt, tokenAssetId)])) | |
235 | 235 | } | |
236 | 236 | } | |
237 | 237 | ||
238 | 238 | ||
239 | 239 | ||
240 | 240 | @Callable(i) | |
241 | 241 | func cancelCoinChallenge (gameId) = { | |
242 | 242 | let gameDataList = ExtractGameDataList(gameId) | |
243 | 243 | let gameState = gameDataList[IdxGameState] | |
244 | 244 | let paCoin = gameDataList[IdxPlayerACoin] | |
245 | 245 | let paPubKey58 = gameDataList[IdxPlayerAPubKey58] | |
246 | 246 | let payType = gameDataList[IdxPayType] | |
247 | 247 | let payAmt = parseIntValue(gameDataList[IdxPayAmt]) | |
248 | 248 | let winAmt = parseIntValue(gameDataList[IdxWinAmt]) | |
249 | 249 | let pubKey58 = toBase58String(i.callerPublicKey) | |
250 | 250 | let feeAssetId = isDefined(i.feeAssetId) | |
251 | 251 | if (feeAssetId) | |
252 | 252 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
253 | 253 | else if ((gameState != STATESUBMITTED)) | |
254 | 254 | then throw("Invalid game state for passed gameId. Game aborted.") | |
255 | 255 | else if ((paPubKey58 != pubKey58)) | |
256 | 256 | then throw("You cannot cancel a game created by another player. Game aborted.") | |
257 | 257 | else if ((i.caller == this)) | |
258 | 258 | then throw("Coinflip contract cannot cancel a game. Game aborted.") | |
259 | 259 | else { | |
260 | 260 | let newGameDataStr = FormatGameDataStr(STATECANCELED, paCoin, paPubKey58, payType, payAmt, winAmt, "", "", "") | |
261 | 261 | let refundAmt = fraction(payAmt, ((100 - FEEWAVESBET) - FEEMCAFEE), 100) | |
262 | 262 | let refundWallet = addressFromPublicKey(fromBase58String(paPubKey58)) | |
263 | 263 | let refundToken = tokenType(payType) | |
264 | - | ScriptResult(WriteSet([DataEntry(gameId, newGameDataStr)]), TransferSet([ScriptTransfer(refundWallet, refundAmt, refundToken)])) | |
264 | + | ScriptResult(WriteSet([DataEntry(gameId, newGameDataStr)]), TransferSet([ScriptTransfer(WALLETWAVESBET, fraction(payAmt, FEEWAVESBET, 100), refundToken), ScriptTransfer(WALLETMCAFEE, fraction(payAmt, FEEMCAFEE, 100), refundToken), ScriptTransfer(refundWallet, refundAmt, refundToken)])) | |
265 | 265 | } | |
266 | 266 | } | |
267 | 267 | ||
268 | 268 |
github/deemru/w8io/026f985 71.97 ms ◑