tx · Dz9sYAqvYNfsoeuJiNBgy8DaXE13QS9K5bxGPSg276Gf

3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd:  -0.10000000 Waves

2021.12.01 02:50 [1814456] smart account 3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd > SELF 0.00000000 Waves

{ "type": 13, "id": "Dz9sYAqvYNfsoeuJiNBgy8DaXE13QS9K5bxGPSg276Gf", "fee": 10000000, "feeAssetId": null, "timestamp": 1638316270284, "version": 2, "chainId": 84, "sender": "3N6hQF6HBBQ5JCKB8Xs17Q61wkG3VrLvbGd", "senderPublicKey": "7Hi4o6vBstRs79NMVMjEove52dmP87RAcvNDAXN8C4Wi", "proofs": [ "5ALppwiUjRz93fQFVugiRUMgzui4hC2kbo7uAvsqD1J8G5ezBLicyvBs3Ngkn3L9NgpGYyuZ4uDgTKa3p81WH1Zu" ], "script": "base64:AAIFAAAAAAAAA1EIAhIDCgEIEgMKAQgSAwoBCBoMCgJhMRIGY2FzaW5vGgsKAmEyEgVXQVZFUxoMCgJhMxIGbWF4QmV0Gg8KAmE0EglzZXBhcmF0b3IaEAoCYTUSCmdldE5ld0RlY2saDQoCYTYSB2dldERlY2saCgoCYTcSBGRlY2saFQoCYTgSD2dldFJhbmRvbU51bWJlchoLCgJhORIFc2FsdDEaCwoCYjESBXNhbHQyGhIKAmIyEgxhbnN3ZXJzQ291bnQaCgoCYjMSBGhhc2gaCwoCYjQSBWluZGV4GgoKAmI1EgRyYW5kGh0KAmI2EhdnZXRQcmV2aW91c1JhbmRvbU51bWJlchoNCgJiNxIHYWRkcmVzcxoNCgJiOBIHJG1hdGNoMBoVCgJiORIPZ2V0QW1vdW50T3JaZXJvGgoKAmMxEgR0aGlzGgkKAmMyEgNrZXkaEAoCYzMSCmdldFBheW1lbnQaCQoCYzQSA3BtdBoSCgJjNRIMZ2V0Q2FyZFZhbHVlGhAKAmM2EgpzdHJpbmdDYXJkGg8KAmM3EglnZXRXaW5uZXIaEAoC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AAgIAAAADMDRECQAETAAAAAICAAAAAzA1RAkABEwAAAACAgAAAAMwNkQJAARMAAAAAgIAAAADMDdECQAETAAAAAICAAAAAzA4RAkABEwAAAACAgAAAAMwOUQJAARMAAAAAgIAAAADMTBECQAETAAAAAICAAAAAzExRAkABEwAAAACAgAAAAMxMkQJAARMAAAAAgIAAAADMTNECQAETAAAAAICAAAAAzAxSAkABEwAAAACAgAAAAMwMkgJAARMAAAAAgIAAAADMDNICQAETAAAAAICAAAAAzA0SAkABEwAAAACAgAAAAMwNUgJAARMAAAAAgIAAAADMDZICQAETAAAAAICAAAAAzA3SAkABEwAAAACAgAAAAMwOEgJAARMAAAAAgIAAAADMDlICQAETAAAAAICAAAAAzEwSAkABEwAAAACAgAAAAMxMUgJAARMAAAAAgIAAAADMTJICQAETAAAAAICAAAAAzEzSAkABEwAAAACAgAAAAMwMVMJAARMAAAAAgIAAAADMDJTCQAETAAAAAICAAAAAzAzUwkABEwAAAACAgAAAAMwNFMJAARMAAAAAgIAAAADMDVTCQAETAAAAAICAAAAAzA2UwkABEwAAAACAgAAAAMwN1MJAARMAAAAAgIAAAADMDhTCQAETAAAAAICAAAAAzA5UwkABEwAAAACAgAAAAMxMFMJAARMAAAAAgIAAAADMTFTCQAETAAAAAICAAAAAzEyUwkABEwAAAACAgAAAAMxM1MFAAAAA25pbAEAAAACYTYAAAABAAAAAmE3AwkAAGcAAAACAAAAAAAAAAAACQABkAAAAAEFAAAAAmE3CQEAAAACYTUAAAAABQAAAAJhNwEAAAACYTgAAAADAAAAAmE5AAAAAmIxAAAAAmIyBAAAAAJiMwkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAACYTkFAAAAAmIxBAAAAAJiNAkABLEAAAABBQAAAAJiMwQAAAACYjUJAABqAAAAAgUAAAACYjQFAAAAAmIyAwkAAGYAAAACAAAAAAAAAAAABQAAAAJiNQkAAGQAAAACCQAAaAAAAAIA//////////8FAAAAAmI1AAAAAAAAAAABCQAAZAAAAAIFAAAA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UAAAACZDUCAAAAB193aW5uZXIEAAAAAmYyCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAJjMQkAASwAAAACBQAAAAJkNQIAAAAHX3BsYXllcgQAAAACZjMJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAAAmMxCQABLAAAAAIFAAAAAmQ1AgAAAAhfc3VtQmV0cwMJAAAAAAAAAgUAAAACZjMAAAAAAAAAAAAJAAACAAAAAQIAAAAaWW91IHdvbiBub3RoaW5nIHRoaXMgcm91bmQDAwkAAAAAAAACBQAAAAJlOQUAAAACZDEJAAAAAAAAAgUAAAACZTkFAAAAAmExBwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAJmMQkAAaQAAAABBQAAAAJmMwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAAmYzBQAAAAR1bml0BQAAAANuaWwDAwkAAAAAAAACBQAAAAJlOQUAAAACZDEJAAAAAAAAAgUAAAACZTkFAAAAAmYyBwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACBQAAAAJmMQkAAaQAAAABCQAAaAAAAAIFAAAAAmYzAAAAAAAAAAACCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGgAAAACBQAAAAJmMwAAAAAAAAAAAgUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAFllvdSBhcmUgbm90IHRoZSB3aW5uZXIAAAABAAAAAnR4AQAAAAJmNAAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5/KQhyw==", "height": 1814456, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: nZ5dojutrrLe6L2pez8Te1wUBGVHN34gbTXkXX2ZZyq Next: 3dYqNsfbEU6cvWZKbthaShNp3R3gRfysbXFUgArsQCpA Diff:
OldNewDifferences
7979 else deck
8080 }
8181 else getNewDeck()
82+
83+
84+@Callable(i)
85+func lala (round) = [StringEntry("Lala", "1")]
86+
8287
8388
8489 @Callable(i)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let casino = "3MtaCL4v1bjTabUqs7oU4ofS8fbai34WM1i"
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
5656 func getCardValue (stringCard) = {
5757 let p = parseIntValue(take(stringCard, 2))
5858 if ((p == 1))
5959 then 20
6060 else p
6161 }
6262
6363
6464 func getWinner (cardPlayer,cardCasino,callerAddress,casino) = {
6565 let p = getCardValue(cardPlayer)
6666 let o = getCardValue(cardCasino)
6767 if ((p > o))
6868 then callerAddress
6969 else casino
7070 }
7171
7272
7373 func getAvailableDeck (this,availableProp) = if (isDefined(getString(this, availableProp)))
7474 then {
7575 let stringDeck = getStringValue(this, availableProp)
7676 let deck = split(stringDeck, separator)
7777 if ((size(deck) == 0))
7878 then getNewDeck()
7979 else deck
8080 }
8181 else getNewDeck()
82+
83+
84+@Callable(i)
85+func lala (round) = [StringEntry("Lala", "1")]
86+
8287
8388
8489 @Callable(i)
8590 func bet (round) = {
8691 let callerAddress = toBase58String(i.caller.bytes)
8792 let meKey = round
8893 let p = getPayment(i)
8994 let roundBetsKey = (round + "_sumBets")
9095 let curSumBets = getAmountOrZero(c1, roundBetsKey)
9196 let currentDraws = match getInteger(c1, (round + "_drawSequence")) {
9297 case a: Int =>
9398 (a + 1)
9499 case _ =>
95100 0
96101 }
97102 let currentPlayer = match getString(c1, (round + "_player")) {
98103 case a: String =>
99104 a
100105 case _ =>
101106 unit
102107 }
103108 let availableProp = (meKey + "_available")
104109 let newSumBets = (curSumBets + p)
105110 if (if (isDefined(getBoolean(c1, (round + "_stop"))))
106111 then true
107112 else isDefined(getString(c1, round)))
108113 then throw("This round is already played")
109114 else if (if (isDefined(getString(c1, (round + "_player"))))
110115 then (currentPlayer != callerAddress)
111116 else false)
112117 then throw("This is not your game")
113118 else if ((newSumBets > maxBet))
114119 then throw(((("Maximum amount of bets for round " + toString(maxBet)) + ". With your bet it's ") + toString(newSumBets)))
115120 else {
116121 let avDeck = getAvailableDeck(c1, availableProp)
117122 let cardPositionPlayer = getRandomNumber(((meKey + makeString(avDeck, separator)) + callerAddress), getPreviousRandomNumber(callerAddress), size(avDeck))
118123 let cardPlayer = avDeck[(cardPositionPlayer % size(avDeck))]
119124 let avDeck1 = removeByIndex(avDeck, (cardPositionPlayer % size(avDeck)))
120125 let avDeck2 = getDeck(avDeck1)
121126 let cardPositionCasino = getRandomNumber(((meKey + makeString(avDeck2, separator)) + callerAddress), getPreviousRandomNumber(callerAddress), size(avDeck2))
122127 let cardCasino = avDeck2[(cardPositionCasino % size(avDeck2))]
123128 let avDeck3 = removeByIndex(avDeck2, (cardPositionCasino % size(avDeck2)))
124129 if ((getCardValue(cardPlayer) == getCardValue(cardCasino)))
125130 then [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((round + "_player"), callerAddress), StringEntry((meKey + "_salt_debug"), meKey), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), IntegerEntry((round + "_drawSequence"), (currentDraws + 1))]
126131 else {
127132 let winner = getWinner(cardPlayer, cardCasino, callerAddress, casino)
128133 [StringEntry(availableProp, makeString(avDeck3, separator)), StringEntry((meKey + "_salt_debug"), meKey), StringEntry((round + "_player"), callerAddress), IntegerEntry((meKey + "_LastRandonNumber"), cardPositionCasino), IntegerEntry((round + "_sumBets"), newSumBets), StringEntry((meKey + "_playerCard"), cardPlayer), StringEntry((meKey + "_casinoCard"), cardCasino), BooleanEntry((round + "_stop"), true), StringEntry((round + "_winner"), winner)]
129134 }
130135 }
131136 }
132137
133138
134139
135140 @Callable(i)
136141 func withdraw (round) = {
137142 let callerAddress = toBase58String(i.caller.bytes)
138143 let meKey = ((round + "_") + callerAddress)
139144 let withdrawKey = (round + "_withdraw")
140145 if (isDefined(getString(c1, withdrawKey)))
141146 then throw("You have already got your prize")
142147 else if (!(isDefined(getString(c1, (round + "_winner")))))
143148 then throw("There is no winner, it was a draw")
144149 else {
145150 let winner = getStringValue(c1, (round + "_winner"))
146151 let player = getStringValue(c1, (round + "_player"))
147152 let curSumBet = getIntegerValue(c1, (round + "_sumBets"))
148153 if ((curSumBet == 0))
149154 then throw("You won nothing this round")
150155 else if (if ((winner == callerAddress))
151156 then (winner == casino)
152157 else false)
153158 then [StringEntry(withdrawKey, toString(curSumBet)), ScriptTransfer(i.caller, curSumBet, unit)]
154159 else if (if ((winner == callerAddress))
155160 then (winner == player)
156161 else false)
157162 then [StringEntry(withdrawKey, toString((curSumBet * 2))), ScriptTransfer(i.caller, (curSumBet * 2), unit)]
158163 else throw("You are not the winner")
159164 }
160165 }
161166
162167
163168 @Verifier(tx)
164169 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
165170

github/deemru/w8io/026f985 
29.86 ms