tx · 8r6zEhmDQC5HyZvmCqe6vA8AB8WgkWQ54J8s65o4UPHY 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd: -0.10000000 Waves 2021.11.13 04:09 [1788552] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves
{ "type": 13, "id": "8r6zEhmDQC5HyZvmCqe6vA8AB8WgkWQ54J8s65o4UPHY", "fee": 10000000, "feeAssetId": null, "timestamp": 1636765740278, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "47apMWe98E1eKg8fgLRj5GRhcqYMxUJny3uU9gXGK7xUCnPtDzdc8rbjdrvbMzsxx3njsXjtoSK1oPbsirquJNLa" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAAAAAAAAEAAAABaQEAAAAEYmV0MgAAAAEAAAAFcm91bmQEAAAADWNhbGxlckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFbWVLZXkJAAEsAAAAAgkAASwAAAACBQAAAAVyb3VuZAIAAAABXwUAAAANY2FsbGVyQWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAVtZUtleQUAAAAFcm91bmQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5gwkxmg==", "height": 1788552, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: E4R8Z8aZ6BHTn1pFVdS4SxmzPuMM14zUS6zPVQGo6DXX Next: GzRbzDdEZWxK8ZvcYfTsmZjQqPDSzCvDxzkaDcT3wYJz Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let separator = "," | |
5 | - | ||
6 | - | let WAVES = 1000000000 | |
7 | - | ||
8 | - | let maxBet = (100 * WAVES) | |
9 | - | ||
10 | - | func getNewDeck () = ["01C", "02C", "03C", "04C", "05C", "06C", "07C", "08C", "09C", "10C", "11C", "12C", "13C", "01D", "02D", "03D", "04D", "05D", "06D", "07D", "08D", "09D", "10D", "11D", "12D", "13D", "01H", "02H", "03H", "04H", "05H", "06H", "07H", "08H", "09H", "10H", "11H", "12H", "13H", "01S", "02S", "03S", "04S", "05S", "06S", "07S", "08S", "09S", "10S", "11S", "12S", "13S"] | |
11 | - | ||
12 | - | ||
13 | - | func getDeck (deck) = if ((0 >= size(deck))) | |
14 | - | then getNewDeck() | |
15 | - | else deck | |
16 | - | ||
17 | - | ||
18 | - | func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp))) | |
19 | - | then { | |
20 | - | let stringDeck = getStringValue(this, availableProp) | |
21 | - | let deck = split(stringDeck, separator) | |
22 | - | if ((size(deck) == 0)) | |
23 | - | then getNewDeck() | |
24 | - | else deck | |
25 | - | } | |
26 | - | else getNewDeck() | |
27 | - | ||
28 | - | ||
29 | - | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
30 | - | case a: Int => | |
31 | - | a | |
32 | - | case _ => | |
33 | - | 0 | |
34 | - | } | |
35 | - | ||
36 | - | ||
37 | - | func getPayment (i) = if ((size(i.payments) == 0)) | |
38 | - | then throw("Payment must be attached") | |
39 | - | else { | |
40 | - | let pmt = i.payments[0] | |
41 | - | if (isDefined(pmt.assetId)) | |
42 | - | then throw("This function accepts WAVES tokens only") | |
43 | - | else pmt.amount | |
44 | - | } | |
45 | 4 | ||
46 | 5 | ||
47 | 6 | @Callable(i) | |
48 | - | func | |
7 | + | func bet2 (round) = { | |
49 | 8 | let callerAddress = toBase58String(i.caller.bytes) | |
50 | 9 | let meKey = ((round + "_") + callerAddress) | |
51 | - | let p = getPayment(i) | |
52 | - | let roundBetsKey = (meKey + "_sumBets") | |
53 | - | let curSumBets = getAmountOrZero(this, roundBetsKey) | |
54 | - | let currentDraws = match getInteger(this, (meKey + "_drawSequence")) { | |
55 | - | case a: Int => | |
56 | - | (a + 1) | |
57 | - | case _ => | |
58 | - | 0 | |
59 | - | } | |
60 | - | let availableProp = (meKey + "_available") | |
61 | - | let newSumBets = (curSumBets + p) | |
62 | - | if (if (isDefined(getBoolean(this, (round + "_stop")))) | |
63 | - | then true | |
64 | - | else isDefined(getString(this, round))) | |
65 | - | then throw("This round is already played") | |
66 | - | else if ((newSumBets > maxBet)) | |
67 | - | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
68 | - | else { | |
69 | - | let avDeck = getAvailableDeck(this, availableProp) | |
70 | - | [StringEntry(availableProp, makeString(avDeck, separator))] | |
71 | - | } | |
10 | + | [StringEntry(meKey, round)] | |
72 | 11 | } | |
73 | 12 | ||
74 | 13 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let separator = "," | |
5 | - | ||
6 | - | let WAVES = 1000000000 | |
7 | - | ||
8 | - | let maxBet = (100 * WAVES) | |
9 | - | ||
10 | - | func getNewDeck () = ["01C", "02C", "03C", "04C", "05C", "06C", "07C", "08C", "09C", "10C", "11C", "12C", "13C", "01D", "02D", "03D", "04D", "05D", "06D", "07D", "08D", "09D", "10D", "11D", "12D", "13D", "01H", "02H", "03H", "04H", "05H", "06H", "07H", "08H", "09H", "10H", "11H", "12H", "13H", "01S", "02S", "03S", "04S", "05S", "06S", "07S", "08S", "09S", "10S", "11S", "12S", "13S"] | |
11 | - | ||
12 | - | ||
13 | - | func getDeck (deck) = if ((0 >= size(deck))) | |
14 | - | then getNewDeck() | |
15 | - | else deck | |
16 | - | ||
17 | - | ||
18 | - | func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp))) | |
19 | - | then { | |
20 | - | let stringDeck = getStringValue(this, availableProp) | |
21 | - | let deck = split(stringDeck, separator) | |
22 | - | if ((size(deck) == 0)) | |
23 | - | then getNewDeck() | |
24 | - | else deck | |
25 | - | } | |
26 | - | else getNewDeck() | |
27 | - | ||
28 | - | ||
29 | - | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
30 | - | case a: Int => | |
31 | - | a | |
32 | - | case _ => | |
33 | - | 0 | |
34 | - | } | |
35 | - | ||
36 | - | ||
37 | - | func getPayment (i) = if ((size(i.payments) == 0)) | |
38 | - | then throw("Payment must be attached") | |
39 | - | else { | |
40 | - | let pmt = i.payments[0] | |
41 | - | if (isDefined(pmt.assetId)) | |
42 | - | then throw("This function accepts WAVES tokens only") | |
43 | - | else pmt.amount | |
44 | - | } | |
45 | 4 | ||
46 | 5 | ||
47 | 6 | @Callable(i) | |
48 | - | func | |
7 | + | func bet2 (round) = { | |
49 | 8 | let callerAddress = toBase58String(i.caller.bytes) | |
50 | 9 | let meKey = ((round + "_") + callerAddress) | |
51 | - | let p = getPayment(i) | |
52 | - | let roundBetsKey = (meKey + "_sumBets") | |
53 | - | let curSumBets = getAmountOrZero(this, roundBetsKey) | |
54 | - | let currentDraws = match getInteger(this, (meKey + "_drawSequence")) { | |
55 | - | case a: Int => | |
56 | - | (a + 1) | |
57 | - | case _ => | |
58 | - | 0 | |
59 | - | } | |
60 | - | let availableProp = (meKey + "_available") | |
61 | - | let newSumBets = (curSumBets + p) | |
62 | - | if (if (isDefined(getBoolean(this, (round + "_stop")))) | |
63 | - | then true | |
64 | - | else isDefined(getString(this, round))) | |
65 | - | then throw("This round is already played") | |
66 | - | else if ((newSumBets > maxBet)) | |
67 | - | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
68 | - | else { | |
69 | - | let avDeck = getAvailableDeck(this, availableProp) | |
70 | - | [StringEntry(availableProp, makeString(avDeck, separator))] | |
71 | - | } | |
10 | + | [StringEntry(meKey, round)] | |
72 | 11 | } | |
73 | 12 | ||
74 | 13 | ||
75 | 14 | @Verifier(tx) | |
76 | 15 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
77 | 16 |
github/deemru/w8io/026f985 27.72 ms ◑