tx · E4R8Z8aZ6BHTn1pFVdS4SxmzPuMM14zUS6zPVQGo6DXX 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd: -0.10000000 Waves 2021.11.13 03:33 [1788515] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves
{ "type": 13, "id": "E4R8Z8aZ6BHTn1pFVdS4SxmzPuMM14zUS6zPVQGo6DXX", "fee": 10000000, "feeAssetId": null, "timestamp": 1636763735295, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "2rFLn4dqZms6oyKon6bw7vJw5e8r2spA7QAbbkWdFBh7EprRBZ5FFtCbYs4S7BCwuUTxAYZ34XEXbhegmubf7jRa" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAACAAAAAAJc2VwYXJhdG9yAgAAAAEsAAAAAAVXQVZFUwAAAAAAO5rKAAAAAAAGbWF4QmV0CQAAaAAAAAIAAAAAAAAAAGQFAAAABVdBVkVTAQAAAApnZXROZXdEZWNrAAAAAAkABEwAAAACAgAAAAMwMUMJAARMAAAAAgIAAAADMDJDCQAETAAAAAICAAAAAzAzQwkABEwAAAACAgAAAAMwNEMJAARMAAAAAgIAAAADMDVDCQAETAAAAAICAAAAAzA2QwkABEwAAAACAgAAAAMwN0MJAARMAAAAAgIAAAADMDhDCQAETAAAAAICAAAAAzA5QwkABEwAAAACAgAAAAMxMEMJAARMAAAAAgIAAAADMTFDCQAETAAAAAICAAAAAzEyQwkABEwAAAACAgAAAAMxM0MJAARMAAAAAgIAAAADMDFECQAETAAAAAICAAAAAzAyRAkABEwAAAACAgAAAAMwM0QJAARMAAAAAgIAAAADMDRECQAETAAAAAICAAAAAzA1RAkABEwAAAACAgAAAAMwNkQJAARMAAAAAgIAAAADMDdECQAETAAAAAICAAAAAzA4RAk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plexity": 0 } View: original | compacted Prev: 2bymUMbeiD31XfHwj4NbTPgDuJhbKgkhLkAbvbUrnjab Next: 8r6zEhmDQC5HyZvmCqe6vA8AB8WgkWQ54J8s65o4UPHY Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let separator = "," | |
5 | 5 | ||
6 | 6 | let WAVES = 1000000000 | |
7 | 7 | ||
8 | 8 | let maxBet = (100 * WAVES) | |
9 | - | ||
10 | - | let separator = "," | |
11 | 9 | ||
12 | 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"] | |
13 | 11 | ||
17 | 15 | else deck | |
18 | 16 | ||
19 | 17 | ||
20 | - | func getRandomNumber (salt1,salt2,answersCount) = { | |
21 | - | let hash = sha256(toBytes((salt1 + salt2))) | |
22 | - | let index = toInt(hash) | |
23 | - | let rand = (index % answersCount) | |
24 | - | if ((0 > rand)) | |
25 | - | then ((-1 * rand) + 1) | |
26 | - | else (rand + 1) | |
27 | - | } | |
28 | - | ||
29 | - | ||
30 | - | func getPreviousRandomNumber (address) = match getInteger(this, (address + "_LastRandonNumber")) { | |
31 | - | case n: Int => | |
32 | - | toString(n) | |
33 | - | case _ => | |
34 | - | address | |
35 | - | } | |
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() | |
36 | 27 | ||
37 | 28 | ||
38 | 29 | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
53 | 44 | } | |
54 | 45 | ||
55 | 46 | ||
56 | - | func getCardValue (stringCard) = parseIntValue(take(stringCard, 2)) | |
57 | - | ||
58 | - | ||
59 | - | func getWinner (cardPlayer,cardOracle,callerAddress,oracle) = { | |
60 | - | let p = getCardValue(cardPlayer) | |
61 | - | let o = getCardValue(cardOracle) | |
62 | - | if ((p > o)) | |
63 | - | then callerAddress | |
64 | - | else oracle | |
65 | - | } | |
66 | - | ||
67 | - | ||
68 | - | func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp))) | |
69 | - | then { | |
70 | - | let stringDeck = getStringValue(this, availableProp) | |
71 | - | let deck = split(stringDeck, separator) | |
72 | - | if ((size(deck) == 0)) | |
73 | - | then getNewDeck() | |
74 | - | else deck | |
75 | - | } | |
76 | - | else getNewDeck() | |
77 | - | ||
78 | - | ||
79 | 47 | @Callable(i) | |
80 | - | func | |
48 | + | func bet1 (round) = { | |
81 | 49 | let callerAddress = toBase58String(i.caller.bytes) | |
82 | 50 | let meKey = ((round + "_") + callerAddress) | |
83 | 51 | let p = getPayment(i) | |
99 | 67 | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
100 | 68 | else { | |
101 | 69 | let avDeck = getAvailableDeck(this, availableProp) | |
102 | - | let cardPositionPlayer = getRandomNumber((meKey + makeString(avDeck, separator)), getPreviousRandomNumber(callerAddress), size(avDeck)) | |
103 | - | let cardPlayer = avDeck[(cardPositionPlayer % size(avDeck))] | |
104 | - | let avDeck1 = removeByIndex(avDeck, (cardPositionPlayer % size(avDeck))) | |
105 | - | let avDeck2 = getDeck(avDeck1) | |
106 | - | let cardPositionOracle = getRandomNumber((meKey + makeString(avDeck2, separator)), getPreviousRandomNumber(callerAddress), size(avDeck2)) | |
107 | - | let cardOracle = avDeck2[(cardPositionOracle % size(avDeck2))] | |
108 | - | let avDeck3 = removeByIndex(avDeck2, (cardPositionPlayer % size(avDeck2))) | |
109 | - | if ((getCardValue(cardPlayer) == getCardValue(cardOracle))) | |
110 | - | then [IntegerEntry((meKey + "_drawSequence"), (currentDraws + 1))] | |
111 | - | else { | |
112 | - | let winner = getWinner(cardPlayer, cardOracle, callerAddress, oracle) | |
113 | - | [StringEntry((meKey + "_winner"), winner)] | |
114 | - | } | |
70 | + | [StringEntry(availableProp, makeString(avDeck, separator))] | |
115 | 71 | } | |
116 | - | } | |
117 | - | ||
118 | - | ||
119 | - | ||
120 | - | @Callable(i) | |
121 | - | func withdraw (round) = { | |
122 | - | let callerAddress = toBase58String(i.caller.bytes) | |
123 | - | let meKey = ((round + "_") + callerAddress) | |
124 | - | let withdrawKey = (meKey + "_withdraw") | |
125 | - | if (isDefined(getString(this, withdrawKey))) | |
126 | - | then throw("You have already got your prize") | |
127 | - | else if (isDefined(getInteger(this, (meKey + "_drawSequence")))) | |
128 | - | then throw("There is no winner, it was a draw") | |
129 | - | else if (!(isDefined(getString(this, (meKey + "_winner"))))) | |
130 | - | then throw("There is no winner") | |
131 | - | else { | |
132 | - | let winner = getStringValue(this, (meKey + "_winner")) | |
133 | - | let curSumBet = getIntegerValue(this, (meKey + "_sumBets")) | |
134 | - | if ((curSumBet == 0)) | |
135 | - | then throw("You won nothing this round") | |
136 | - | else if ((winner == callerAddress)) | |
137 | - | then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)] | |
138 | - | else throw("You are not the winner") | |
139 | - | } | |
140 | 72 | } | |
141 | 73 | ||
142 | 74 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let separator = "," | |
5 | 5 | ||
6 | 6 | let WAVES = 1000000000 | |
7 | 7 | ||
8 | 8 | let maxBet = (100 * WAVES) | |
9 | - | ||
10 | - | let separator = "," | |
11 | 9 | ||
12 | 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"] | |
13 | 11 | ||
14 | 12 | ||
15 | 13 | func getDeck (deck) = if ((0 >= size(deck))) | |
16 | 14 | then getNewDeck() | |
17 | 15 | else deck | |
18 | 16 | ||
19 | 17 | ||
20 | - | func getRandomNumber (salt1,salt2,answersCount) = { | |
21 | - | let hash = sha256(toBytes((salt1 + salt2))) | |
22 | - | let index = toInt(hash) | |
23 | - | let rand = (index % answersCount) | |
24 | - | if ((0 > rand)) | |
25 | - | then ((-1 * rand) + 1) | |
26 | - | else (rand + 1) | |
27 | - | } | |
28 | - | ||
29 | - | ||
30 | - | func getPreviousRandomNumber (address) = match getInteger(this, (address + "_LastRandonNumber")) { | |
31 | - | case n: Int => | |
32 | - | toString(n) | |
33 | - | case _ => | |
34 | - | address | |
35 | - | } | |
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() | |
36 | 27 | ||
37 | 28 | ||
38 | 29 | func getAmountOrZero (this,key) = match getInteger(this, key) { | |
39 | 30 | case a: Int => | |
40 | 31 | a | |
41 | 32 | case _ => | |
42 | 33 | 0 | |
43 | 34 | } | |
44 | 35 | ||
45 | 36 | ||
46 | 37 | func getPayment (i) = if ((size(i.payments) == 0)) | |
47 | 38 | then throw("Payment must be attached") | |
48 | 39 | else { | |
49 | 40 | let pmt = i.payments[0] | |
50 | 41 | if (isDefined(pmt.assetId)) | |
51 | 42 | then throw("This function accepts WAVES tokens only") | |
52 | 43 | else pmt.amount | |
53 | 44 | } | |
54 | 45 | ||
55 | 46 | ||
56 | - | func getCardValue (stringCard) = parseIntValue(take(stringCard, 2)) | |
57 | - | ||
58 | - | ||
59 | - | func getWinner (cardPlayer,cardOracle,callerAddress,oracle) = { | |
60 | - | let p = getCardValue(cardPlayer) | |
61 | - | let o = getCardValue(cardOracle) | |
62 | - | if ((p > o)) | |
63 | - | then callerAddress | |
64 | - | else oracle | |
65 | - | } | |
66 | - | ||
67 | - | ||
68 | - | func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp))) | |
69 | - | then { | |
70 | - | let stringDeck = getStringValue(this, availableProp) | |
71 | - | let deck = split(stringDeck, separator) | |
72 | - | if ((size(deck) == 0)) | |
73 | - | then getNewDeck() | |
74 | - | else deck | |
75 | - | } | |
76 | - | else getNewDeck() | |
77 | - | ||
78 | - | ||
79 | 47 | @Callable(i) | |
80 | - | func | |
48 | + | func bet1 (round) = { | |
81 | 49 | let callerAddress = toBase58String(i.caller.bytes) | |
82 | 50 | let meKey = ((round + "_") + callerAddress) | |
83 | 51 | let p = getPayment(i) | |
84 | 52 | let roundBetsKey = (meKey + "_sumBets") | |
85 | 53 | let curSumBets = getAmountOrZero(this, roundBetsKey) | |
86 | 54 | let currentDraws = match getInteger(this, (meKey + "_drawSequence")) { | |
87 | 55 | case a: Int => | |
88 | 56 | (a + 1) | |
89 | 57 | case _ => | |
90 | 58 | 0 | |
91 | 59 | } | |
92 | 60 | let availableProp = (meKey + "_available") | |
93 | 61 | let newSumBets = (curSumBets + p) | |
94 | 62 | if (if (isDefined(getBoolean(this, (round + "_stop")))) | |
95 | 63 | then true | |
96 | 64 | else isDefined(getString(this, round))) | |
97 | 65 | then throw("This round is already played") | |
98 | 66 | else if ((newSumBets > maxBet)) | |
99 | 67 | then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets))) | |
100 | 68 | else { | |
101 | 69 | let avDeck = getAvailableDeck(this, availableProp) | |
102 | - | let cardPositionPlayer = getRandomNumber((meKey + makeString(avDeck, separator)), getPreviousRandomNumber(callerAddress), size(avDeck)) | |
103 | - | let cardPlayer = avDeck[(cardPositionPlayer % size(avDeck))] | |
104 | - | let avDeck1 = removeByIndex(avDeck, (cardPositionPlayer % size(avDeck))) | |
105 | - | let avDeck2 = getDeck(avDeck1) | |
106 | - | let cardPositionOracle = getRandomNumber((meKey + makeString(avDeck2, separator)), getPreviousRandomNumber(callerAddress), size(avDeck2)) | |
107 | - | let cardOracle = avDeck2[(cardPositionOracle % size(avDeck2))] | |
108 | - | let avDeck3 = removeByIndex(avDeck2, (cardPositionPlayer % size(avDeck2))) | |
109 | - | if ((getCardValue(cardPlayer) == getCardValue(cardOracle))) | |
110 | - | then [IntegerEntry((meKey + "_drawSequence"), (currentDraws + 1))] | |
111 | - | else { | |
112 | - | let winner = getWinner(cardPlayer, cardOracle, callerAddress, oracle) | |
113 | - | [StringEntry((meKey + "_winner"), winner)] | |
114 | - | } | |
70 | + | [StringEntry(availableProp, makeString(avDeck, separator))] | |
115 | 71 | } | |
116 | - | } | |
117 | - | ||
118 | - | ||
119 | - | ||
120 | - | @Callable(i) | |
121 | - | func withdraw (round) = { | |
122 | - | let callerAddress = toBase58String(i.caller.bytes) | |
123 | - | let meKey = ((round + "_") + callerAddress) | |
124 | - | let withdrawKey = (meKey + "_withdraw") | |
125 | - | if (isDefined(getString(this, withdrawKey))) | |
126 | - | then throw("You have already got your prize") | |
127 | - | else if (isDefined(getInteger(this, (meKey + "_drawSequence")))) | |
128 | - | then throw("There is no winner, it was a draw") | |
129 | - | else if (!(isDefined(getString(this, (meKey + "_winner"))))) | |
130 | - | then throw("There is no winner") | |
131 | - | else { | |
132 | - | let winner = getStringValue(this, (meKey + "_winner")) | |
133 | - | let curSumBet = getIntegerValue(this, (meKey + "_sumBets")) | |
134 | - | if ((curSumBet == 0)) | |
135 | - | then throw("You won nothing this round") | |
136 | - | else if ((winner == callerAddress)) | |
137 | - | then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)] | |
138 | - | else throw("You are not the winner") | |
139 | - | } | |
140 | 72 | } | |
141 | 73 | ||
142 | 74 | ||
143 | 75 | @Verifier(tx) | |
144 | 76 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
145 | 77 |
github/deemru/w8io/026f985 27.52 ms ◑