tx · 7vyiQGc9nm7XvfnvdrNWi1QMZAqp3yLmbv71K4Dw4T9b

3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX:  -0.05000000 Waves

2019.10.29 15:47 [741453] smart account 3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX > SELF 0.00000000 Waves

{ "type": 13, "id": "7vyiQGc9nm7XvfnvdrNWi1QMZAqp3yLmbv71K4Dw4T9b", "fee": 5000000, "feeAssetId": null, "timestamp": 1572353238715, "version": 1, "sender": "3N2tusqAtDctK8iSTXS6F9rimmftmSuwLUX", "senderPublicKey": "ACfUG5PwG2GssMuyEwVEhkYAbbbP1geSHR8XoNxLyu6V", "proofs": [ "33RmNvoZcdMuyAQ5hFGeQYhqVSRRxeJV5r2zyCKbiER7ttJDjgJpAfm5SwVQLKLNCtDJZtGu5EiarhhFmDdnAqmW" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAAiAAAAAAlSU0FQVUJMSUMJAAJbAAAAAQIAAAGPYmFzZTY0Ok1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBZzRkQVI2WGJCREFTOWhyL0VqM2RKdjZGZmM0NjZ4L21PR01XVTNsckFCczNxYThCSG11Skdua2ZicEVmMnZBd1lUT1dQdnZ6Zk0xME9CYmZsb1N5cTNjOU1LdnlUZTFsdUJMR3FXNHZaVVhJeXZTZ3oxbGl5VVZlZklReTNkeUY5amJlVFpiQzBiYmNULzdPM0RFTCswMXo2QStyRENhY1NaMGxHb2xTUTZBbmhMeHpJa1ZwT1FKYnJCbUMreCtadVpQQ01Xekp5bmQ1YWVPbjdqYWovbWtSVnl4ZTZnLzBPaFd6NE5paVpYZXVNUkIrOG1LeTBmV0QvVWxJbFpXSHNBUzJabXJrWEtxakxxMC8wd3I4SUxKa3pualNxZG5JNUliamczdVFyai80QU4raTlyMjhhUTczL1prUHRZNVNidzBBT2lBQkJ1N2dIbXE5YXlWeFpRSURBUUFCAA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F5bWVudAQAAAAGd2luQW10CQEAAAAaVmFsaWRhdGVCZXRBbmREZWZpbmVXaW5BbXQAAAADCAUAAAAHcGF5bWVudAAAAAZhbW91bnQFAAAABnBhQ29pbgUAAAAHcGF5VHlwZQQAAAALZ2FtZURhdGFTdHIJAQAAABFGb3JtYXRHYW1lRGF0YVN0cgAAAAkFAAAADlNUQVRFU1VCTUlUVEVEBQAAAAZwYUNvaW4FAAAAD3BsYXllckFQdWJLZXk1OAUAAAAHcGF5VHlwZQgFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAAZ3aW5BbXQCAAAAAAIAAAAAAgAAAAAJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA9HQU1FU0NPVU5URVJLRVkFAAAACm5ld0dhbWVOdW0JAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABmdhbWVJZAUAAAALZ2FtZURhdGFTdHIFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQUAAAADbmlsAAAAAWkBAAAAE2NhbmNlbENvaW5DaGFsbGVuZ2UAAAABAAAABmdhbWVJZAQAAAAKcmF3RGF0YVN0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAAZnYW1lSWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAADc3RyBQAAAAckbWF0Y2gwBQAAAANzdHIJAAACAAAAAQkAASwAAAACAgAAABZDb3VsZG4ndCBmaW5kIGdhbWUgYnkgBQAAAAZnYW1lSWQJAAACAAAAAQUAAAAKcmF3RGF0YVN0cgAAAAA+Medt", "chainId": 84, "height": 741453, "spentComplexity": 0 } View: original | compacted Prev: CBf5MMqUGzr2W74fyEG1D7ERGR6V8RST6qRAejNtfMCb Next: 8Zy83qKBhnYGHLK7WxVwkmBgp7Bw8j1PdmbszNT2DDXi Diff:
OldNewDifferences
137137
138138
139139 func ExtractGameDataList (gameId) = {
140- let rawDataStr = getStringValue(this, gameId)
141- rawDataStr
140+ let rawDataStr = match getString(this, gameId) {
141+ case str: String =>
142+ str
143+ case _ =>
144+ throw(("Couldn't find game by " + gameId))
145+ }
146+ ParseGameRawDataStr(rawDataStr)
142147 }
143148
144149
185190
186191 @Callable(i)
187192 func cancelCoinChallenge (gameId) = {
188- let rawDataStr = getStringValue(this, gameId)
193+ let rawDataStr = match getString(this, gameId) {
194+ case str: String =>
195+ str
196+ case _ =>
197+ throw(("Couldn't find game by " + gameId))
198+ }
189199 throw(rawDataStr)
190200 }
191201
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RSAPUBLIC = fromBase64String("base64:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg4dAR6XbBDAS9hr/Ej3dJv6Ffc466x/mOGMWU3lrABs3qa8BHmuJGnkfbpEf2vAwYTOWPvvzfM10OBbfloSyq3c9MKvyTe1luBLGqW4vZUXIyvSgz1liyUVefIQy3dyF9jbeTZbC0bbcT/7O3DEL+01z6A+rDCacSZ0lGolSQ6AnhLxzIkVpOQJbrBmC+x+ZuZPCMWzJynd5aeOn7jaj/mkRVyxe6g/0OhWz4NiiZXeuMRB+8mKy0fWD/UlIlZWHsAS2ZmrkXKqjLq0/0wr8ILJkznjSqdnI5Ibjg3uQrj/4AN+i9r28aQ73/ZkPtY5Sbw0AOiABBu7gHmq9ayVxZQIDAQAB")
55
66 let GAMESCOUNTERKEY = "$GAME_NUM"
77
88 let WBET = base58'23vgV9p9pD83A7CFbsDEc4zjanep7UeFo4ZRS6oGorhv'
99
1010 let FEEWAVESBET = 4
1111
1212 let FEEMCAFEE = 2
1313
1414 let WAVELET = 100000000
1515
1616 let STATESUBMITTED = "SUBMITTED"
1717
1818 let STATEACCEPTED = "ACCEPTED"
1919
2020 let STATEFINISHED = "FINISHED"
2121
2222 let STATECANCELED = "CANCELED"
2323
2424 let COINRED = "RED"
2525
2626 let COINBLUE = "BLUE"
2727
2828 let BETMINWAVES = ((1 * WAVELET) / 2)
2929
3030 let BETMINWBET = (100 * WAVELET)
3131
3232 let IdxGameState = 0
3333
3434 let IdxPlayerACoin = 1
3535
3636 let IdxPlayerAPubKey58 = 2
3737
3838 let IdxPayType = 3
3939
4040 let IdxPayAmt = 4
4141
4242 let IdxWinAmt = 5
4343
4444 let IdxPlayerBCoin = 6
4545
4646 let IdxPlayerBPubKey58 = 7
4747
4848 let IdxLuckyCoin = 8
4949
5050 func IncrementGameNum () = {
5151 let gameNum = match getInteger(this, GAMESCOUNTERKEY) {
5252 case num: Int =>
5353 num
5454 case _ =>
5555 0
5656 }
5757 (gameNum + 1)
5858 }
5959
6060
6161 func generateNumber (inv,max,min) = {
6262 let lastPlay = match getBinary(this, "lastPlay") {
6363 case s: ByteVector =>
6464 s
6565 case a: Unit =>
6666 base58'2ee4oFDYriWJ9EMeR'
6767 case _ =>
6868 throw()
6969 }
7070 let rand = (((((lastPlay + inv.transactionId) + inv.callerPublicKey) + lastBlock.generationSignature) + toBytes(lastBlock.timestamp)) + toBytes(lastBlock.height))
7171 (((toInt(sha256(rand)) % 1000) % ((max - min) + 1)) + 1)
7272 }
7373
7474
7575 func paymentType (payment) = if ((payment.assetId == WBET))
7676 then "WBET"
7777 else "WAVES"
7878
7979
8080 func tokenType (token) = if ((token == "WBET"))
8181 then WBET
8282 else unit
8383
8484
8585 func FormatGameDataParam (p) = {
8686 let s = size(p)
8787 if ((s == 0))
8888 then throw("Parameter size must be greater then 0")
8989 else if ((s > 99))
9090 then throw("Parameter size must be less then 100")
9191 else if ((10 > s))
9292 then (("0" + toString(s)) + p)
9393 else (toString(s) + p)
9494 }
9595
9696
9797 func FormatGameDataStr (gameState,playerACoin,playerAPubKey58,payType,payAmount,winAmt,playerBCoin,playerBPubKey58,luckyCoin) = {
9898 let fullStateStr = ((((((((((FormatGameDataParam(gameState) + "_") + FormatGameDataParam(playerACoin)) + "_") + FormatGameDataParam(playerAPubKey58)) + "_") + FormatGameDataParam(payType)) + "_") + FormatGameDataParam(toString(payAmount))) + "_") + FormatGameDataParam(toString(winAmt)))
9999 if (if (if ((playerBCoin == ""))
100100 then true
101101 else (playerBPubKey58 == ""))
102102 then true
103103 else (luckyCoin == ""))
104104 then fullStateStr
105105 else ((((((fullStateStr + "_") + FormatGameDataParam(playerBCoin)) + "_") + FormatGameDataParam(playerBPubKey58)) + "_") + FormatGameDataParam(luckyCoin))
106106 }
107107
108108
109109 func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0))
110110 then drop(remaining, 1)
111111 else remaining
112112
113113
114114 func ParseNextAttribute (remaining) = {
115115 let s = size(remaining)
116116 if ((s > 0))
117117 then {
118118 let nn = parseIntValue(take(remaining, 2))
119119 let v = take(drop(remaining, 2), nn)
120120 let tmpRemaining = drop(remaining, (nn + 2))
121121 let remainingState = RemoveUnderscoreIfPresent(tmpRemaining)
122122 [v, remainingState]
123123 }
124124 else throw("Empty string was passed into parseNextAttribute func")
125125 }
126126
127127
128128 func ParseGameRawDataStr (rawStateStr) = {
129129 let gameState = ParseNextAttribute(rawStateStr)
130130 let paCoin = ParseNextAttribute(gameState[1])
131131 let paPubKey58 = ParseNextAttribute(paCoin[1])
132132 let payType = ParseNextAttribute(paPubKey58[1])
133133 let payAmt = ParseNextAttribute(payType[1])
134134 let winAmt = ParseNextAttribute(payAmt[1])
135135 [gameState[0], paCoin[0], paPubKey58[0], payType[0], payAmt[0], winAmt[0]]
136136 }
137137
138138
139139 func ExtractGameDataList (gameId) = {
140- let rawDataStr = getStringValue(this, gameId)
141- rawDataStr
140+ let rawDataStr = match getString(this, gameId) {
141+ case str: String =>
142+ str
143+ case _ =>
144+ throw(("Couldn't find game by " + gameId))
145+ }
146+ ParseGameRawDataStr(rawDataStr)
142147 }
143148
144149
145150 func ValidateBetAndDefineWinAmt (amount,playerCoin,paymentType) = if (if ((playerCoin != COINRED))
146151 then (playerCoin != COINBLUE)
147152 else false)
148153 then throw("Invalid play, change your bet to RED or BLUE coin. Game aborted.")
149154 else if (if ((paymentType == "WBET"))
150155 then (BETMINWBET > amount)
151156 else false)
152157 then throw(("The minimum bet on Wbet is " + toString((BETMINWBET / WAVELET))))
153158 else if (if ((paymentType == "WAVES"))
154159 then (BETMINWAVES > amount)
155160 else false)
156161 then throw(("The minimum bet on Waves is " + toString((BETMINWAVES / WAVELET))))
157162 else (((amount * 2) * (100 - (FEEWAVESBET + FEEMCAFEE))) / 100)
158163
159164
160165 @Callable(i)
161166 func playCoin (paCoin) = {
162167 let gameId = toBase58String(i.transactionId)
163168 let gameIdUsed = isDefined(getString(this, gameId))
164169 let payment = extract(i.payment)
165170 let feeAssetId = isDefined(i.feeAssetId)
166171 if (if ((payment.assetId != assetInfo(base58'WAVES')))
167172 then (payment.assetId != WBET)
168173 else false)
169174 then throw("Payment should be in Wbet or Waves. Game aborted.")
170175 else if (feeAssetId)
171176 then throw("Transaction's fee must be in Waves. Game aborted.")
172177 else if (gameIdUsed)
173178 then throw("Passed gameId had been used before. Game aborted.")
174179 else {
175180 let newGameNum = IncrementGameNum()
176181 let playerAPubKey58 = toBase58String(i.callerPublicKey)
177182 let payType = paymentType(payment)
178183 let winAmt = ValidateBetAndDefineWinAmt(payment.amount, paCoin, payType)
179184 let gameDataStr = FormatGameDataStr(STATESUBMITTED, paCoin, playerAPubKey58, payType, payment.amount, winAmt, "", "", "")
180185 ScriptResult(WriteSet([DataEntry(GAMESCOUNTERKEY, newGameNum), DataEntry(gameId, gameDataStr)]), TransferSet(nil))
181186 }
182187 }
183188
184189
185190
186191 @Callable(i)
187192 func cancelCoinChallenge (gameId) = {
188- let rawDataStr = getStringValue(this, gameId)
193+ let rawDataStr = match getString(this, gameId) {
194+ case str: String =>
195+ str
196+ case _ =>
197+ throw(("Couldn't find game by " + gameId))
198+ }
189199 throw(rawDataStr)
190200 }
191201
192202

github/deemru/w8io/026f985 
31.79 ms