tx · L7odvTZf4qHxfwczwtCjvmpHHnsn6jkNNvzes2m7Raj 3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8: -0.01400000 Waves 2019.12.11 02:05 [803330] smart account 3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8 > SELF 0.00000000 Waves
{ "type": 13, "id": "L7odvTZf4qHxfwczwtCjvmpHHnsn6jkNNvzes2m7Raj", "fee": 1400000, "feeAssetId": null, "timestamp": 1576019145614, "version": 1, "sender": "3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8", "senderPublicKey": "6uncmj7GmSzxFAGGX8NcToqPxTxWUHW7Aj1WSbMH2qXw", "proofs": [ "3uRNPVyW2jMMfYcMXTSA56kgh4tBSrS7LcT5XKXUaXMJCM3eEZtVEQJvTWKbWthZaZk2CfDpo5KdYF7Z7sAbxSAf" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAADwAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQWc0ZEFSNlhiQkRBUzloci9FajNkSnY2RmZjNDY2eC9tT0dNV1UzbHJBQnMzcWE4QkhtdUpHbmtmYnBFZjJ2QXdZVE9XUHZ2emZNMTBPQmJmbG9TeXEzYzlNS3Z5VGUxbHVCTEdxVzR2WlVYSXl2U2d6MWxpeVVWZWZJUXkzZHlGOWpiZVRaYkMwYmJjVC83TzNERUwrMDF6NkErckRDYWNTWjBsR29sU1E2QW5oTHh6SWtWcE9RSmJyQm1DK3grWnVaUENNV3pKeW5kNWFlT243amFqL21rUlZ5eGU2Zy8wT2hXejROaWlaWGV1TVJCKzhtS3kwZldEL1VsSWxaV0hzQVMyWm1ya1hLcWpMcTAvMHdyOElMSmt6bmpTcWRuSTVJYmpnM3VRcmovNEFOK2k5cjI4YVE3My9aa1B0WTVTYncwQU9pQUJCdTdnSG1xOWF5VnhaUUlEQVFBQgA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FRAIAAAABXwUAAAAOcGxheWVyUHViS2V5NTgCAAAAAV8FAAAABGJldHMJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA9HQU1FU0NPVU5URVJLRVkFAAAACm5ld0dhbWVOdW0JAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABmdhbWVJZAUAAAALZ2FtZURhdGFTdHIFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAC+yhJs=", "chainId": 84, "height": 803330, "spentComplexity": 0 } View: original | compacted Prev: 2c25SLZ75rY4Fn43yBzt6g8uGQkCaisQZzW6DQqwMfv7 Next: 2LGBLtP3dbiqw4a58x2hc5UMiw3N8jxU3NugaQCsXiXN Diff:
Old | New | Differences | |
---|---|---|---|
51 | 51 | let payment = extract(i.payment) | |
52 | 52 | let feeAssetId = isDefined(i.feeAssetId) | |
53 | 53 | let playerBalance = wavesBalance(i.caller) | |
54 | - | let a = getAmt(bets) | |
54 | + | let a = (getAmt(bets) * 1000000000) | |
55 | 55 | if ((payment.assetId != WBET)) | |
56 | 56 | then throw("Payment should be in Wavesbet") | |
57 | 57 | else if ((1000000 > playerBalance)) |
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 | 31 | let bts = split(bets, "_") | |
32 | 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))) | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func IncrementGameNum () = { | |
37 | 37 | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
38 | 38 | case num: Int => | |
39 | 39 | num | |
40 | 40 | case _ => | |
41 | 41 | 0 | |
42 | 42 | } | |
43 | 43 | (gameNum + 1) | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | @Callable(i) | |
48 | 48 | func playRoulette (bets) = { | |
49 | 49 | let gameId = toBase58String(i.transactionId) | |
50 | 50 | let gameIdUsed = isDefined(getString(this, gameId)) | |
51 | 51 | let payment = extract(i.payment) | |
52 | 52 | let feeAssetId = isDefined(i.feeAssetId) | |
53 | 53 | let playerBalance = wavesBalance(i.caller) | |
54 | - | let a = getAmt(bets) | |
54 | + | let a = (getAmt(bets) * 1000000000) | |
55 | 55 | if ((payment.assetId != WBET)) | |
56 | 56 | then throw("Payment should be in Wavesbet") | |
57 | 57 | else if ((1000000 > playerBalance)) | |
58 | 58 | then throw("There are not enough waves, it takes 0.01 Waves to bet. Game aborted.") | |
59 | 59 | else if (feeAssetId) | |
60 | 60 | then throw("Transaction's fee must be in Waves. Game aborted.") | |
61 | 61 | else if (gameIdUsed) | |
62 | 62 | then throw("Passed gameId had been used before. Game aborted.") | |
63 | 63 | else if ((a != payment.amount)) | |
64 | 64 | then throw((("Payment value is different from bet value. " + toString(a)) + toString(payment.amount))) | |
65 | 65 | else { | |
66 | 66 | let newGameNum = IncrementGameNum() | |
67 | 67 | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
68 | 68 | let gameDataStr = ((((STATESUBMITTED + "_") + playerPubKey58) + "_") + bets) | |
69 | 69 | ScriptResult(WriteSet([DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet(nil)) | |
70 | 70 | } | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 |
github/deemru/w8io/169f3d6 36.45 ms ◑