tx · EGezpAQHUcvZ8iUTJymQdKJCHYeqmA57gFhgRVzKTGRJ 3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8: -0.01400000 Waves 2019.12.11 01:03 [803262] smart account 3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8 > SELF 0.00000000 Waves
{ "type": 13, "id": "EGezpAQHUcvZ8iUTJymQdKJCHYeqmA57gFhgRVzKTGRJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1576014707934, "version": 1, "sender": "3Mz7zzdQoHabgytXU3UuTAzADXPBBLgFqu8", "senderPublicKey": "6uncmj7GmSzxFAGGX8NcToqPxTxWUHW7Aj1WSbMH2qXw", "proofs": [ "ixj3ucZcpDtXgYtLirr6fj6BfWFoNFKiFyUu79Y7aZLeB3aaWTPQccREQVGUmUb5dk7FJwR5pSydqurbnAMkWRt" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAEQAAAAAJUlNBUFVCTElDCQACWwAAAAECAAABj2Jhc2U2NDpNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQWc0ZEFSNlhiQkRBUzloci9FajNkSnY2RmZjNDY2eC9tT0dNV1UzbHJBQnMzcWE4QkhtdUpHbmtmYnBFZjJ2QXdZVE9XUHZ2emZNMTBPQmJmbG9TeXEzYzlNS3Z5VGUxbHVCTEdxVzR2WlVYSXl2U2d6MWxpeVVWZWZJUXkzZHlGOWpiZVRaYkMwYmJjVC83TzNERUwrMDF6NkErckRDYWNTWjBsR29sU1E2QW5oTHh6SWtWcE9RSmJyQm1DK3grWnVaUENNV3pKeW5kNWFlT243amFqL21rUlZ5eGU2Zy8wT2hXejROaWlaWGV1TVJCKzhtS3kwZldEL1VsSWxaV0hzQVMyWm1ya1hLcWpMcTAvMHdyOElMSmt6bmpTcWRuSTVJYmpnM3VRcmovNEFOK2k5cjI4YVE3My9aa1B0WTVTYncwQU9pQUJCdTdnSG1xOWF5VnhaUUlEQVFBQ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2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAPR0FNRVNDT1VOVEVSS0VZBQAAAApuZXdHYW1lTnVtCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAZnYW1lSWQFAAAAC2dhbWVEYXRhU3RyBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEFAAAAA25pbAAAAAAEvW8r", "chainId": 84, "height": 803262, "spentComplexity": 0 } View: original | compacted Prev: none Next: BkeAYrsim4zz7fwZHGJwqC5ED9nwaNkMjSeum7bKY8E8 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB") | |
5 | + | ||
6 | + | let GAMESCOUNTERKEY = "$GAME_NUM" | |
7 | + | ||
8 | + | let WBET = base58'A4q1mYKo11yuH9gmvDodeJoksagcyQzeFE9JtphMWddw' | |
9 | + | ||
10 | + | let WALLETWAVESBET = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
11 | + | ||
12 | + | let WALLETMCAFEE = Address(base58'3MtCy2PCFPyu8A9SRNL4qUo1V17SGLHftD8') | |
13 | + | ||
14 | + | let WAVELET = 100000000 | |
15 | + | ||
16 | + | let FEEWAVESBET = 4 | |
17 | + | ||
18 | + | let FEEMCAFEE = 2 | |
19 | + | ||
20 | + | let STATESUBMITTED = "SUBMITTED" | |
21 | + | ||
22 | + | let STATEWON = "WON" | |
23 | + | ||
24 | + | let STATELOST = "LOST" | |
25 | + | ||
26 | + | let BETMIN = (1 * WAVELET) | |
27 | + | ||
28 | + | let BETMAX = (20000000 * WAVELET) | |
29 | + | ||
30 | + | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
31 | + | then drop(remaining, 1) | |
32 | + | else remaining | |
33 | + | ||
34 | + | ||
35 | + | func ParseBet (remaining) = { | |
36 | + | let s = size(remaining) | |
37 | + | if ((s > 0)) | |
38 | + | then { | |
39 | + | let nn = parseIntValue(take(remaining, 2)) | |
40 | + | let v = take(drop(remaining, 2), nn) | |
41 | + | let tmpRemaining = drop(remaining, (nn + 2)) | |
42 | + | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
43 | + | [v, remainingState] | |
44 | + | } | |
45 | + | else throw("Invalid bet range, game aborted!") | |
46 | + | } | |
47 | + | ||
48 | + | ||
49 | + | func getAmt (bets) = { | |
50 | + | let b01 = ParseBet(bets) | |
51 | + | let b02 = ParseBet(b01[1]) | |
52 | + | let b03 = ParseBet(b02[1]) | |
53 | + | let b04 = ParseBet(b03[1]) | |
54 | + | let b05 = ParseBet(b04[1]) | |
55 | + | let b06 = ParseBet(b05[1]) | |
56 | + | let b07 = ParseBet(b06[1]) | |
57 | + | let b08 = ParseBet(b07[1]) | |
58 | + | let b09 = ParseBet(b08[1]) | |
59 | + | let b10 = ParseBet(b09[1]) | |
60 | + | (((((((((parseIntValue(b01[1]) + parseIntValue(b02[1])) + parseIntValue(b03[1])) + parseIntValue(b04[1])) + parseIntValue(b05[1])) + parseIntValue(b06[1])) + parseIntValue(b07[1])) + parseIntValue(b08[1])) + parseIntValue(b09[1])) + parseIntValue(b10[1])) | |
61 | + | } | |
62 | + | ||
63 | + | ||
64 | + | func IncrementGameNum () = { | |
65 | + | let gameNum = match getInteger(this, GAMESCOUNTERKEY) { | |
66 | + | case num: Int => | |
67 | + | num | |
68 | + | case _ => | |
69 | + | 0 | |
70 | + | } | |
71 | + | (gameNum + 1) | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | @Callable(i) | |
76 | + | func playRoulette (bets) = { | |
77 | + | let gameId = toBase58String(i.transactionId) | |
78 | + | let gameIdUsed = isDefined(getString(this, gameId)) | |
79 | + | let payment = extract(i.payment) | |
80 | + | let feeAssetId = isDefined(i.feeAssetId) | |
81 | + | let playerBalance = wavesBalance(i.caller) | |
82 | + | let a = getAmt(bets) | |
83 | + | if ((payment.assetId != WBET)) | |
84 | + | then throw("Payment should be in Wavesbet") | |
85 | + | else if ((1000000 > playerBalance)) | |
86 | + | then throw("There are not enough waves, it takes 0.01 Waves to bet. Game aborted.") | |
87 | + | else if (feeAssetId) | |
88 | + | then throw("Transaction's fee must be in Waves. Game aborted.") | |
89 | + | else if (gameIdUsed) | |
90 | + | then throw("Passed gameId had been used before. Game aborted.") | |
91 | + | else if ((a != payment.amount)) | |
92 | + | then throw("Payment value is different from bet value.") | |
93 | + | else { | |
94 | + | let newGameNum = IncrementGameNum() | |
95 | + | let playerPubKey58 = toBase58String(i.callerPublicKey) | |
96 | + | let gameDataStr = ((((STATESUBMITTED + "_") + playerPubKey58) + "_") + bets) | |
97 | + | ScriptResult(WriteSet([DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet(nil)) | |
98 | + | } | |
99 | + | } | |
100 | + | ||
101 | + |
github/deemru/w8io/169f3d6 26.47 ms ◑