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