tx · BaMHGgyYutk5LidMNg6G4uZh3bPp4Cyzjpe7yHU34G3Q

3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT:  -0.01400000 Waves

2019.07.01 17:48 [566458] smart account 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT > SELF 0.00000000 Waves

{ "type": 13, "id": "BaMHGgyYutk5LidMNg6G4uZh3bPp4Cyzjpe7yHU34G3Q", "fee": 1400000, "feeAssetId": null, "timestamp": 1561992563194, "version": 1, "sender": "3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT", "senderPublicKey": "Bhyvkx4xdbEi4KPJNZSzx9gZgzgyLEsavuj2kYSt7SST", "proofs": [ "5C63osX3ouFtUwLAnynu3ndvp5mzwbDFXrDUNLUvAx71s1VsYTD9jECY4Xt13jSj7YwHueiaSjsdKyNGgGdmJ63t" ], "script": "base64:AAIDAAAAAAAAAAAAAAAlAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIL79hxhmqWX34iA/RS9p36FY3qCJjLclClmAz4vj6GlBAAAAAA1TZXJ2ZXJBZGRyZXNzCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNNdThvS1NjV0N3UjMzWW9tVDV1a1U3M1A3akxyeVpUazRzAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAABFEYXRhR2FtZU51bWJlcktleQIAAAALQVBQX0dBTUVfSUQAAAAADURhdGFBbW91bnRLZXkCAAAABkFNT1VOVAAAAAAORGF0YVNlY3Rpb25LZXkCAAAAB1NFQ1RJT04AAAAADURhdGFTdGF0dXNLZXkCAAAABlNUQVRVUwAAAAANRGF0YVJlc3VsdEtleQIAAAAGUkVTVUxUAAAAAA1EYXRhU3RhdHVzTmV3AgAAAANORVcAAAAADURhdGFTdGF0dXNXaW4CAAAAA1dJTgAAAAAPRGF0YVN0YXR1c0xvb3NlAgAAAAVMT09TRQAAAAAHV0FWRUxFVAkAAGgAA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YW1lVHJhbnNhY3Rpb25JZAUAAAANRGF0YVJlc3VsdEtleQUAAAAEcmFuZAUAAAADbmlsAwUAAAAFaXNXaW4JAQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAAh3cml0ZVNldAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAA1TZXJ2ZXJBZGRyZXNzBQAAAApDT01NSVNTSU9OBQAAAAR1bml0BQAAAANuaWwFAAAACHdyaXRlU2V0CQAAAgAAAAEJAAEsAAAAAgUAAAANRXJyb3JHYW1lT3ZlcgUAAAAGc3RhdHVzAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAMJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAYHBwpUYDY=", "chainId": 84, "height": 566458, "spentComplexity": 0 } View: original | compacted Prev: 2CZ7UFXYCrbK4y5hjcr5eUcotxt42ci8foTcBbXDQf7H Next: DYJDQozRVgGREyCMJgLw9Ac4hK9ji5tsjw3quXw6PVti Diff:
OldNewDifferences
146146 let feeNotInWaves = isDefined(pmt.assetId)
147147 let amount = pmt.amount
148148 let winAmt = ValidateAmount(pmt.amount)
149- if (isIncorrectResult)
149+ if (if (isIncorrectResult)
150+ then true
151+ else winAmt)
150152 then throw(ErrorIncorrectSectionResult)
151153 else if (betNotInWaves)
152154 then throw(ErrorBetMustBeInWaves)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let ServerPublicKey = base58'DrYgfD7j6AKD1iXtn9uhMka95ATZB42B1kGKCUATP2UG'
55
66 let ServerAddress = addressFromStringValue("3Mu8oKScWCwR33YomT5ukU73P7jLryZTk4s")
77
88 let RouletteSections = 21
99
1010 let DataGameNumberKey = "APP_GAME_ID"
1111
1212 let DataAmountKey = "AMOUNT"
1313
1414 let DataSectionKey = "SECTION"
1515
1616 let DataStatusKey = "STATUS"
1717
1818 let DataResultKey = "RESULT"
1919
2020 let DataStatusNew = "NEW"
2121
2222 let DataStatusWin = "WIN"
2323
2424 let DataStatusLoose = "LOOSE"
2525
2626 let WAVELET = ((100 * 1000) * 1000)
2727
2828 let COMMISSION = ((5 * WAVELET) / 1000)
2929
3030 let BET1 = (1 * WAVELET)
3131
3232 let BET2 = (2 * WAVELET)
3333
3434 let BET4 = (4 * WAVELET)
3535
3636 let BET8 = (8 * WAVELET)
3737
3838 let BET14 = (14 * WAVELET)
3939
4040 let Sections = [0, 2, 20, 2, 5, 2, 10, 2, 6, 2, 5, 2, 6, 2, 5, 2, 10, 2, 5, 2, 6]
4141
4242 let ErrorOnlyWavesAccepted = "Only waves accepted"
4343
4444 let ErrorMustGreaterThan0 = "Parameter size must be greater than 0"
4545
4646 let ErrorMustLessThan100 = "Parameter size must be less than 100"
4747
4848 let ErrorBetMustBeInWaves = "Bet amount must be in Waves"
4949
5050 let ErrorTransactionMustBeInWaves = "Transaction's fee must be in Waves"
5151
5252 let ErrorTransactionUsed = "Passed txId had been used before. Game aborted."
5353
5454 let ErrorKeyNotFound = "Key not found: "
5555
5656 let ErrorGameOver = "Game already is over"
5757
5858 let ErrorIncorrectSectionResult = "Incorrect section result"
5959
6060 let ErrorBetAmountNotInRange = "Bet amount is not in range"
6161
6262 func StoreData (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value)
6363
6464
6565 func StoreDataInt (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value)
6666
6767
6868 func GetDataString (transactionId,key) = {
6969 let fullKey = ((transactionId + "_") + key)
7070 match getString(this, fullKey) {
7171 case str: String =>
7272 str
7373 case _ =>
7474 throw((ErrorKeyNotFound + fullKey))
7575 }
7676 }
7777
7878
7979 func GetDataInt (transactionId,key) = {
8080 let fullKey = ((transactionId + "_") + key)
8181 match getInteger(this, fullKey) {
8282 case str: Int =>
8383 str
8484 case _ =>
8585 throw((ErrorKeyNotFound + fullKey))
8686 }
8787 }
8888
8989
9090 func NewGameId () = {
9191 let gameNum = match getInteger(this, DataGameNumberKey) {
9292 case num: Int =>
9393 num
9494 case _ =>
9595 0
9696 }
9797 (gameNum + 1)
9898 }
9999
100100
101101 func GenerateRandInt (gameId,rsaSign) = {
102102 let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey)
103103 if (rsaSigValid)
104104 then {
105105 let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections)
106106 if ((0 > rand))
107107 then (-1 * rand)
108108 else rand
109109 }
110110 else throw("Invalid RSA signature")
111111 }
112112
113113
114114 func GetStatus (result) = if (result)
115115 then DataStatusWin
116116 else DataStatusLoose
117117
118118
119119 func ValidateAmount (betAmt) = {
120120 let betAmtValid = if (if (if (if ((betAmt == (BET1 + COMMISSION)))
121121 then true
122122 else (betAmt == (BET2 + COMMISSION)))
123123 then true
124124 else (betAmt == (BET4 + COMMISSION)))
125125 then true
126126 else (betAmt == (BET8 + COMMISSION)))
127127 then true
128128 else (betAmt == (BET14 + COMMISSION))
129129 if (betAmtValid)
130130 then throw("ok ok")
131131 else throw("not okoko")
132132 }
133133
134134
135135 @Callable(i)
136136 func bet (expectedResult) = {
137137 let isIncorrectResult = if ((0 >= expectedResult))
138138 then true
139139 else (expectedResult > 20)
140140 let gameNumber = NewGameId()
141141 let gameTransactionId = toBase58String(i.transactionId)
142142 let address = toBase58String(i.caller.bytes)
143143 let pmt = extract(i.payment)
144144 let txIdUsed = isDefined(getString(this, gameTransactionId))
145145 let betNotInWaves = isDefined(pmt.assetId)
146146 let feeNotInWaves = isDefined(pmt.assetId)
147147 let amount = pmt.amount
148148 let winAmt = ValidateAmount(pmt.amount)
149- if (isIncorrectResult)
149+ if (if (isIncorrectResult)
150+ then true
151+ else winAmt)
150152 then throw(ErrorIncorrectSectionResult)
151153 else if (betNotInWaves)
152154 then throw(ErrorBetMustBeInWaves)
153155 else if (feeNotInWaves)
154156 then throw(ErrorTransactionMustBeInWaves)
155157 else if (txIdUsed)
156158 then throw(ErrorTransactionUsed)
157159 else ScriptResult(WriteSet([DataEntry(gameTransactionId, address), DataEntry(DataGameNumberKey, gameNumber), StoreDataInt(gameTransactionId, DataAmountKey, amount), StoreDataInt(gameTransactionId, DataSectionKey, expectedResult), StoreData(gameTransactionId, DataStatusKey, DataStatusNew)]), TransferSet([ScriptTransfer(ServerAddress, COMMISSION, unit)]))
158160 }
159161
160162
161163
162164 @Callable(i)
163165 func result (gameTransactionId,rsa) = {
164166 let rand = GenerateRandInt(gameTransactionId, rsa)
165167 let selectedSection = GetDataInt(gameTransactionId, DataSectionKey)
166168 let status = GetDataString(gameTransactionId, DataStatusKey)
167169 if ((status == DataStatusNew))
168170 then {
169171 let isWin = (rand == selectedSection)
170172 let writeSet = WriteSet([StoreData(gameTransactionId, DataStatusKey, GetStatus(isWin)), StoreDataInt(gameTransactionId, DataResultKey, rand)])
171173 if (isWin)
172174 then ScriptResult(writeSet, TransferSet([ScriptTransfer(ServerAddress, COMMISSION, unit)]))
173175 else writeSet
174176 }
175177 else throw((ErrorGameOver + status))
176178 }
177179
178180
179181 @Verifier(tx)
180182 func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))
181183 then match tx {
182184 case stx: SetScriptTransaction =>
183185 true
184186 case _ =>
185187 false
186188 }
187189 else false
188190

github/deemru/w8io/169f3d6 
61.79 ms