tx · GDQ1cPy9CCeFH4kceDc89HpCxDzq7DsNNcmt9aXwkDqZ

3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd:  -0.10000000 Waves

2021.11.13 05:02 [1788603] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves

{ "type": 13, "id": "GDQ1cPy9CCeFH4kceDc89HpCxDzq7DsNNcmt9aXwkDqZ", "fee": 10000000, "feeAssetId": null, "timestamp": 1636768939033, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "5EqH2wNTSm8V2ymnamYgzYU62firJYMqJ5MvmF2fqeGQm5K5MuYe5TEGtZsRs2prjfdGfY59w34T7kakxZ43uJXr" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEIEgMKAQgAAAANAAAAAAZjYXNpbm8CAAAAIzNONmhRRjZIQkJRNUpDS0I4WHMxN1E2MXdrRzNWckx2YkdkAAAAAAVXQVZFUwAAAAAAO5rKAAAAAAAGbWF4QmV0CQAAaAAAAAIAAAAAAAAAAGQFAAAABVdBVkVTAAAAAAlzZXBhcmF0b3ICAAAAASwBAAAACmdldE5ld0RlY2sAAAAACQAETAAAAAICAAAAAzAxQwkABEwAAAACAgAAAAMwMkMJAARMAAAAAgIAAAADMDNDCQAETAAAAAICAAAAAzA0QwkABEwAAAACAgAAAAMwNUMJAARMAAAAAgIAAAADMDZDCQAETAAAAAICAAAAAzA3QwkABEwAAAACAgAAAAMwOEMJAARMAAAAAgIAAAADMDlDCQAETAAAAAICAAAAAzEwQwkABEwAAAACAgAAAAMxMUMJAARMAAAAAgIAAAADMTJDCQAETAAAAAICAAAAAzEzQwkABEwAAAACAgAAAAMwMUQJAARMAAAAAgIAAAADMDJECQAETAAAAAICAAAAAzAzRAkABEwAAAACAgAAAAMwNEQJAARMAAAAA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IG5vIHdpbm5lcgQAAAAGd2lubmVyCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAABXJvdW5kAgAAAAdfd2lubmVyBAAAAAljdXJTdW1CZXQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAFbWVLZXkCAAAACF9zdW1CZXRzAwkAAAAAAAACBQAAAAljdXJTdW1CZXQAAAAAAAAAAAAJAAACAAAAAQIAAAAaWW91IHdvbiBub3RoaW5nIHRoaXMgcm91bmQDCQAAAAAAAAIFAAAABndpbm5lcgUAAAANY2FsbGVyQWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAt3aXRoZHJhd0tleQkAAaQAAAABBQAAAAljdXJTdW1CZXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAljdXJTdW1CZXQFAAAABHVuaXQFAAAAA25pbAkAAAIAAAABAgAAABZZb3UgYXJlIG5vdCB0aGUgd2lubmVyAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXm4vrut", "height": 1788603, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GzRbzDdEZWxK8ZvcYfTsmZjQqPDSzCvDxzkaDcT3wYJz Next: 3Xik9hri5yVkEgykdMhcAj7YDb7V4PGp18EDGfgjnmcM Diff:
OldNewDifferences
5353 }
5454
5555
56-func getCardValue (stringCard) = parseIntValue(take(stringCard, 2))
56+func getCardValue (stringCard) = {
57+ let p = parseIntValue(take(stringCard, 2))
58+ if ((p == 1))
59+ then 20
60+ else p
61+ }
5762
5863
5964 func getWinner (cardPlayer,cardCasino,callerAddress,casino) = {
8388 let p = getPayment(i)
8489 let roundBetsKey = (meKey + "_sumBets")
8590 let curSumBets = getAmountOrZero(this, roundBetsKey)
86- let currentDraws = match getInteger(this, (meKey + "_drawSequence")) {
91+ let currentDraws = match getInteger(this, (round + "_drawSequence")) {
8792 case a: Int =>
8893 (a + 1)
8994 case _ =>
107112 let cardCasino = avDeck2[(cardPositionCasino % size(avDeck2))]
108113 let avDeck3 = removeByIndex(avDeck2, (cardPositionPlayer % size(avDeck2)))
109114 if ((getCardValue(cardPlayer) == getCardValue(cardCasino)))
110- then [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), IntegerEntry((meKey + "_drawSequence"), (currentDraws + 1))]
115+ then [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), (currentDraws + 1))]
111116 else {
112117 let winner = getWinner(cardPlayer, cardCasino, callerAddress, casino)
113-[StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), BooleanEntry((meKey + "_stop"), true), StringEntry((meKey + "_winner"), winner)]
118+[StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), BooleanEntry((meKey + "_stop"), true), StringEntry((round + "_winner"), winner)]
114119 }
115120 }
116121 }
124129 let withdrawKey = (meKey + "_withdraw")
125130 if (isDefined(getString(this, withdrawKey)))
126131 then throw("You have already got your prize")
127- else if (isDefined(getInteger(this, (meKey + "_drawSequence"))))
132+ else if (isDefined(getInteger(this, (round + "_drawSequence"))))
128133 then throw("There is no winner, it was a draw")
129- else if (!(isDefined(getString(this, (meKey + "_winner")))))
134+ else if (!(isDefined(getString(this, (round + "_winner")))))
130135 then throw("There is no winner")
131136 else {
132- let winner = getStringValue(this, (meKey + "_winner"))
137+ let winner = getStringValue(this, (round + "_winner"))
133138 let curSumBet = getIntegerValue(this, (meKey + "_sumBets"))
134139 if ((curSumBet == 0))
135140 then throw("You won nothing this round")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let casino = "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd"
55
66 let WAVES = 1000000000
77
88 let maxBet = (100 * WAVES)
99
1010 let separator = ","
1111
1212 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"]
1313
1414
1515 func getDeck (deck) = if ((0 >= size(deck)))
1616 then getNewDeck()
1717 else deck
1818
1919
2020 func getRandomNumber (salt1,salt2,answersCount) = {
2121 let hash = sha256(toBytes((salt1 + salt2)))
2222 let index = toInt(hash)
2323 let rand = (index % answersCount)
2424 if ((0 > rand))
2525 then ((-1 * rand) + 1)
2626 else (rand + 1)
2727 }
2828
2929
3030 func getPreviousRandomNumber (address) = match getInteger(this, (address + "_LastRandonNumber")) {
3131 case n: Int =>
3232 toString(n)
3333 case _ =>
3434 address
3535 }
3636
3737
3838 func getAmountOrZero (this,key) = match getInteger(this, key) {
3939 case a: Int =>
4040 a
4141 case _ =>
4242 0
4343 }
4444
4545
4646 func getPayment (i) = if ((size(i.payments) == 0))
4747 then throw("Payment must be attached")
4848 else {
4949 let pmt = i.payments[0]
5050 if (isDefined(pmt.assetId))
5151 then throw("This function accepts WAVES tokens only")
5252 else pmt.amount
5353 }
5454
5555
56-func getCardValue (stringCard) = parseIntValue(take(stringCard, 2))
56+func getCardValue (stringCard) = {
57+ let p = parseIntValue(take(stringCard, 2))
58+ if ((p == 1))
59+ then 20
60+ else p
61+ }
5762
5863
5964 func getWinner (cardPlayer,cardCasino,callerAddress,casino) = {
6065 let p = getCardValue(cardPlayer)
6166 let o = getCardValue(cardCasino)
6267 if ((p > o))
6368 then callerAddress
6469 else casino
6570 }
6671
6772
6873 func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp)))
6974 then {
7075 let stringDeck = getStringValue(this, availableProp)
7176 let deck = split(stringDeck, separator)
7277 if ((size(deck) == 0))
7378 then getNewDeck()
7479 else deck
7580 }
7681 else getNewDeck()
7782
7883
7984 @Callable(i)
8085 func bet (round) = {
8186 let callerAddress = toBase58String(i.caller.bytes)
8287 let meKey = ((round + "_") + callerAddress)
8388 let p = getPayment(i)
8489 let roundBetsKey = (meKey + "_sumBets")
8590 let curSumBets = getAmountOrZero(this, roundBetsKey)
86- let currentDraws = match getInteger(this, (meKey + "_drawSequence")) {
91+ let currentDraws = match getInteger(this, (round + "_drawSequence")) {
8792 case a: Int =>
8893 (a + 1)
8994 case _ =>
9095 0
9196 }
9297 let availableProp = (meKey + "_available")
9398 let newSumBets = (curSumBets + p)
9499 if (if (isDefined(getBoolean(this, (round + "_stop"))))
95100 then true
96101 else isDefined(getString(this, round)))
97102 then throw("This round is already played")
98103 else if ((newSumBets > maxBet))
99104 then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets)))
100105 else {
101106 let avDeck = getAvailableDeck(this, availableProp)
102107 let cardPositionPlayer = getRandomNumber((meKey + makeString(avDeck, separator)), getPreviousRandomNumber(callerAddress), size(avDeck))
103108 let cardPlayer = avDeck[(cardPositionPlayer % size(avDeck))]
104109 let avDeck1 = removeByIndex(avDeck, (cardPositionPlayer % size(avDeck)))
105110 let avDeck2 = getDeck(avDeck1)
106111 let cardPositionCasino = getRandomNumber((meKey + makeString(avDeck2, separator)), getPreviousRandomNumber(callerAddress), size(avDeck2))
107112 let cardCasino = avDeck2[(cardPositionCasino % size(avDeck2))]
108113 let avDeck3 = removeByIndex(avDeck2, (cardPositionPlayer % size(avDeck2)))
109114 if ((getCardValue(cardPlayer) == getCardValue(cardCasino)))
110- then [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), IntegerEntry((meKey + "_drawSequence"), (currentDraws + 1))]
115+ then [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), (currentDraws + 1))]
111116 else {
112117 let winner = getWinner(cardPlayer, cardCasino, callerAddress, casino)
113-[StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), BooleanEntry((meKey + "_stop"), true), StringEntry((meKey + "_winner"), winner)]
118+[StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((meKey + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), BooleanEntry((meKey + "_stop"), true), StringEntry((round + "_winner"), winner)]
114119 }
115120 }
116121 }
117122
118123
119124
120125 @Callable(i)
121126 func withdraw (round) = {
122127 let callerAddress = toBase58String(i.caller.bytes)
123128 let meKey = ((round + "_") + callerAddress)
124129 let withdrawKey = (meKey + "_withdraw")
125130 if (isDefined(getString(this, withdrawKey)))
126131 then throw("You have already got your prize")
127- else if (isDefined(getInteger(this, (meKey + "_drawSequence"))))
132+ else if (isDefined(getInteger(this, (round + "_drawSequence"))))
128133 then throw("There is no winner, it was a draw")
129- else if (!(isDefined(getString(this, (meKey + "_winner")))))
134+ else if (!(isDefined(getString(this, (round + "_winner")))))
130135 then throw("There is no winner")
131136 else {
132- let winner = getStringValue(this, (meKey + "_winner"))
137+ let winner = getStringValue(this, (round + "_winner"))
133138 let curSumBet = getIntegerValue(this, (meKey + "_sumBets"))
134139 if ((curSumBet == 0))
135140 then throw("You won nothing this round")
136141 else if ((winner == callerAddress))
137142 then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)]
138143 else throw("You are not the winner")
139144 }
140145 }
141146
142147
143148 @Verifier(tx)
144149 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
145150

github/deemru/w8io/026f985 
33.14 ms