tx · 2c25SLZ75rY4Fn43yBzt6g8uGQkCaisQZzW6DQqwMfv7 3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8: -0.01400000 Waves 2019.12.11 02:01 [803327] smart account 3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8 > SELF 0.00000000 Waves
{ "type": 13, "id": "2c25SLZ75rY4Fn43yBzt6g8uGQkCaisQZzW6DQqwMfv7", "fee": 1400000, "feeAssetId": null, "timestamp": 1576018900482, "version": 1, "sender": "3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8", "senderPublicKey": "6uncmj7GmSzxFAGGX8NcToqPxTxWUHW7Aj1WSbMH2qXw", "proofs": [ "eQZphx9AWCBPbgwuPSBR5BVzXzULYn41bKMTuoNpoRPA8Fptaud5tDEhwd88o2WiUizEpkTJxbA7usUk51SFX1F" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAADwAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQWc0ZEFSNlhiQkRBUzloci9FajNkSnY2RmZjNDY2eC9tT0dNV1UzbHJBQnMzcWE4QkhtdUpHbmtmYnBFZjJ2QXdZVE9XUHZ2emZNMTBPQmJmbG9TeXEzYzlNS3Z5VGUxbHVCTEdxVzR2WlVYSXl2U2d6MWxpeVVWZWZJUXkzZHlGOWpiZVRaYkMwYmJjVC83TzNERUwrMDF6NkErckRDYWNTWjBsR29sU1E2QW5oTHh6SWtWcE9RSmJyQm1DK3grWnVaUENNV3pKeW5kNWFlT243amFqL21rUlZ5eGU2Zy8wT2hXejROaWlaWGV1TVJCKzhtS3kwZldEL1VsSWxaV0hzQVMyWm1ya1hLcWpMcTAvMHdyOElMSmt6bmpTcWRuSTVJYmpnM3VRcmovNEFOK2k5cjI4YVE3My9aa1B0WTVTYncwQU9pQUJCdTdnSG1xOWF5VnhaUUlEQVFBQgAAAA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ADnBsYXllclB1YktleTU4AgAAAAFfBQAAAARiZXRzCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAPR0FNRVNDT1VOVEVSS0VZBQAAAApuZXdHYW1lTnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZnYW1lSWQFAAAAC2dhbWVEYXRhU3RyBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAACaIkZi", "chainId": 84, "height": 803327, "spentComplexity": 0 } View: original | compacted Prev: 6JkRa4ErCMiCbFSgakUMvXJRJLUCJ6wmnU1kTCD5AfL4 Next: L7odvTZf4qHxfwczwtCjvmpHHnsn6jkNNvzes2m7Raj Diff:
Old | New | Differences | |
---|---|---|---|
28 | 28 | let BETMAX = (20000000 * WAVELET) | |
29 | 29 | ||
30 | 30 | func getAmt (bets) = { | |
31 | - | let b01 = take(drop(bets, 4), 10) | |
32 | - | let b02 = take(drop(bets, 19), 10) | |
33 | - | let b03 = take(drop(bets, 34), 10) | |
34 | - | let b04 = take(drop(bets, 49), 10) | |
35 | - | let b05 = take(drop(bets, 64), 10) | |
36 | - | let b06 = take(drop(bets, 79), 10) | |
37 | - | let b07 = take(drop(bets, 94), 10) | |
38 | - | let b08 = take(drop(bets, 109), 10) | |
39 | - | let b09 = take(drop(bets, 124), 10) | |
40 | - | let b10 = take(drop(bets, 139), 10) | |
41 | - | (((((((((parseIntValue(b01) + parseIntValue(b02)) + parseIntValue(b03)) + parseIntValue(b04)) + parseIntValue(b05)) + parseIntValue(b06)) + parseIntValue(b07)) + parseIntValue(b08)) + parseIntValue(b09)) + parseIntValue(b10)) | |
31 | + | let bts = split(bets, "_") | |
32 | + | (((((((((parseIntValue(drop(bts[0], 4)) + parseIntValue(drop(bts[1], 4))) + parseIntValue(drop(bts[2], 4))) + parseIntValue(drop(bts[3], 4))) + parseIntValue(drop(bts[4], 4))) + parseIntValue(drop(bts[5], 4))) + parseIntValue(drop(bts[6], 4))) + parseIntValue(drop(bts[7], 4))) + parseIntValue(drop(bts[8], 4))) + parseIntValue(drop(bts[9], 4))) | |
42 | 33 | } | |
43 | 34 | ||
44 | 35 |
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 WAVELET = 100000000 | |
15 | 15 | ||
16 | 16 | let FEEWAVESBET = 4 | |
17 | 17 | ||
18 | 18 | let FEEMCAFEE = 2 | |
19 | 19 | ||
20 | 20 | let STATESUBMITTED = "SUBMITTED" | |
21 | 21 | ||
22 | 22 | let STATEWON = "WON" | |
23 | 23 | ||
24 | 24 | let STATELOST = "LOST" | |
25 | 25 | ||
26 | 26 | let BETMIN = (1 * WAVELET) | |
27 | 27 | ||
28 | 28 | let BETMAX = (20000000 * WAVELET) | |
29 | 29 | ||
30 | 30 | func getAmt (bets) = { | |
31 | - | let b01 = take(drop(bets, 4), 10) | |
32 | - | let b02 = take(drop(bets, 19), 10) | |
33 | - | let b03 = take(drop(bets, 34), 10) | |
34 | - | let b04 = take(drop(bets, 49), 10) | |
35 | - | let b05 = take(drop(bets, 64), 10) | |
36 | - | let b06 = take(drop(bets, 79), 10) | |
37 | - | let b07 = take(drop(bets, 94), 10) | |
38 | - | let b08 = take(drop(bets, 109), 10) | |
39 | - | let b09 = take(drop(bets, 124), 10) | |
40 | - | let b10 = take(drop(bets, 139), 10) | |
41 | - | (((((((((parseIntValue(b01) + parseIntValue(b02)) + parseIntValue(b03)) + parseIntValue(b04)) + parseIntValue(b05)) + parseIntValue(b06)) + parseIntValue(b07)) + parseIntValue(b08)) + parseIntValue(b09)) + parseIntValue(b10)) | |
31 | + | let bts = split(bets, "_") | |
32 | + | (((((((((parseIntValue(drop(bts[0], 4)) + parseIntValue(drop(bts[1], 4))) + parseIntValue(drop(bts[2], 4))) + parseIntValue(drop(bts[3], 4))) + parseIntValue(drop(bts[4], 4))) + parseIntValue(drop(bts[5], 4))) + parseIntValue(drop(bts[6], 4))) + parseIntValue(drop(bts[7], 4))) + parseIntValue(drop(bts[8], 4))) + parseIntValue(drop(bts[9], 4))) | |
42 | 33 | } | |
43 | 34 | ||
44 | 35 | ||
45 | 36 | func IncrementGameNum () = { | |
46 | 37 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
47 | 38 | case num: Int => | |
48 | 39 | num | |
49 | 40 | case _ => | |
50 | 41 | 0 | |
51 | 42 | } | |
52 | 43 | (gameNum + 1) | |
53 | 44 | } | |
54 | 45 | ||
55 | 46 | ||
56 | 47 | @Callable(i) | |
57 | 48 | func playRoulette (bets) = { | |
58 | 49 | let gameId = toBase58String(i.transactionId) | |
59 | 50 | let gameIdUsed = isDefined(getString(this, gameId)) | |
60 | 51 | let payment = extract(i.payment) | |
61 | 52 | let feeAssetId = isDefined(i.feeAssetId) | |
62 | 53 | let playerBalance = wavesBalance(i.caller) | |
63 | 54 | let a = getAmt(bets) | |
64 | 55 | if ((payment.assetId != WBET)) | |
65 | 56 | then throw("Payment should be in Wavesbet") | |
66 | 57 | else if ((1000000 > playerBalance)) | |
67 | 58 | then throw("There are not enough waves, it takes 0.01 Waves to bet. Game aborted.") | |
68 | 59 | else if (feeAssetId) | |
69 | 60 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
70 | 61 | else if (gameIdUsed) | |
71 | 62 | then throw("Passed gameId had been used before. Game aborted.") | |
72 | 63 | else if ((a != payment.amount)) | |
73 | 64 | then throw((("Payment value is different from bet value. " + toString(a)) + toString(payment.amount))) | |
74 | 65 | else { | |
75 | 66 | let newGameNum = IncrementGameNum() | |
76 | 67 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
77 | 68 | let gameDataStr = ((((STATESUBMITTED + "_") + playerPubKey58) + "_") + bets) | |
78 | 69 | ScriptResult(WriteSet([DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet(nil)) | |
79 | 70 | } | |
80 | 71 | } | |
81 | 72 | ||
82 | 73 |
github/deemru/w8io/169f3d6 65.69 ms ◑