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