tx · 4CQ18K3uJgXZADXcoMHDp6gYwPbJceeztouqet1667ey 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT: -0.14000000 Waves 2019.08.05 15:16 [617581] smart account 3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT > SELF 0.00000000 Waves
{ "type": 13, "id": "4CQ18K3uJgXZADXcoMHDp6gYwPbJceeztouqet1667ey", "fee": 14000000, "feeAssetId": null, "timestamp": 1565007410955, "version": 1, "sender": "3N8M61KCm8G72mK8PjacFbnnxdbFsyqQDeT", "senderPublicKey": "Bhyvkx4xdbEi4KPJNZSzx9gZgzgyLEsavuj2kYSt7SST", "proofs": [ "2nXYV6ebpBrEUNkoC8WkRJUcQ4ZnM6HQs8UPQXSs8XC4oF5k4hjVQKVqB1NrBQ1MqBx3UK3f4YER6C5B5dPCi2st" ], "script": "base64:AAIDAAAAAAAAAAAAAAAoAAAAAA9TZXJ2ZXJQdWJsaWNLZXkBAAAAIAsoHUeLtZkyzNPc+1+ktrvkEUCDQsYcz7NPlRQhjeYWAAAAAA1TZXJ2ZXJBZGRyZXNzCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAECAAAAIzNNdUptQ1NFVWdCTnkxUjJnZXNrNTl4RGJXY3VUS3d3aXhXAAAAABBSb3VsZXR0ZVNlY3Rpb25zAAAAAAAAAAAVAAAAABFEYXRhR2FtZU51bWJlcktleQIAAAALQVBQX0dBTUVfSUQAAAAAD0RhdGFVc2VyR2FtZUtleQIAAAANVVNFUl9HQU1FX0lEXwAAAAANRGF0YUFtb3VudEtleQIAAAAGQU1PVU5UAAAAAA5EYXRhU2VjdGlvbktleQIAAAAHU0VDVElPTgAAAAANRGF0YVN0YXR1c0tleQIAAAAGU1RBVFVTAAAAAA1EYXRhUmVzdWx0S2V5AgAAAAZSRVNVTFQAAAAAEERhdGFXaW5BbW91bnRLZXkCAAAACldJTl9BTU9VTlQAAAAADURhdGFTdGF0dXNOZXcCAAAAA05F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zYWN0aW9uSWQFAAAAEERhdGFXaW5BbW91bnRLZXkJAQAAAAxTY3JpcHRSZXN1bHQAAAACBQAAAAh3cml0ZVNldAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAABndhbGxldAUAAAAJd2luQW1vdW50BQAAAAR1bml0BQAAAANuaWwFAAAACHdyaXRlU2V0CQAAAgAAAAEJAAEsAAAAAgUAAAANRXJyb3JHYW1lT3ZlcgUAAAAGc3RhdHVzAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAMJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAATVHJhbnNmZXJUcmFuc2FjdGlvbgQAAAADdHR4BQAAAAckbWF0Y2gwBgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAA3N0eAUAAAAHJG1hdGNoMAYHBxtC5z4=", "chainId": 84, "height": 617581, "spentComplexity": 0 } View: original | compacted Prev: 4ryAxX5RHsgvgriJuumbX93VCuE3NvRTGj6MeYft8WRe Next: EdELGinsgK7cUh5kETQZfTBYERfiqztu7a1mH1Yao9ij Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ServerPublicKey = base58'kYxoGdY4mv5zMYWYJTq3Pp3uLDuLphTYfT8epjYEJvy' | |
5 | 5 | ||
6 | 6 | let ServerAddress = addressFromStringValue("3MuJmCSEUgBNy1R2gesk59xDbWcuTKwwixW") | |
7 | 7 | ||
8 | 8 | let RouletteSections = 21 | |
9 | 9 | ||
10 | 10 | let DataGameNumberKey = "APP_GAME_ID" | |
11 | 11 | ||
12 | 12 | let DataUserGameKey = "USER_GAME_ID_" | |
13 | 13 | ||
14 | 14 | let DataAmountKey = "AMOUNT" | |
15 | 15 | ||
16 | 16 | let DataSectionKey = "SECTION" | |
17 | 17 | ||
18 | 18 | let DataStatusKey = "STATUS" | |
19 | 19 | ||
20 | 20 | let DataResultKey = "RESULT" | |
21 | 21 | ||
22 | 22 | let DataWinAmountKey = "WIN_AMOUNT" | |
23 | 23 | ||
24 | 24 | let DataStatusNew = "NEW" | |
25 | 25 | ||
26 | 26 | let DataStatusWin = "WIN" | |
27 | 27 | ||
28 | 28 | let DataStatusLoose = "LOOSE" | |
29 | 29 | ||
30 | 30 | let WAVELET = ((100 * 1000) * 1000) | |
31 | 31 | ||
32 | 32 | let COMMISSION = ((5 * WAVELET) / 1000) | |
33 | 33 | ||
34 | 34 | let BET1 = (1 * WAVELET) | |
35 | 35 | ||
36 | 36 | let BET2 = (2 * WAVELET) | |
37 | 37 | ||
38 | 38 | let BET4 = (4 * WAVELET) | |
39 | 39 | ||
40 | 40 | let BET8 = (8 * WAVELET) | |
41 | 41 | ||
42 | 42 | let BET14 = (14 * WAVELET) | |
43 | 43 | ||
44 | 44 | let Sections = [0, 2, 20, 2, 5, 2, 10, 2, 6, 2, 5, 2, 6, 2, 5, 2, 10, 2, 5, 2, 6] | |
45 | 45 | ||
46 | 46 | let ErrorOnlyWavesAccepted = "Only waves accepted" | |
47 | 47 | ||
48 | 48 | let ErrorMustGreaterThan0 = "Parameter size must be greater than 0" | |
49 | 49 | ||
50 | 50 | let ErrorMustLessThan100 = "Parameter size must be less than 100" | |
51 | 51 | ||
52 | 52 | let ErrorBetMustBeInWaves = "Bet amount must be in Waves" | |
53 | 53 | ||
54 | 54 | let ErrorTransactionMustBeInWaves = "Transaction's fee must be in Waves" | |
55 | 55 | ||
56 | 56 | let ErrorTransactionUsed = "Passed txId had been used before. Game aborted." | |
57 | 57 | ||
58 | 58 | let ErrorKeyNotFound = "Key not found: " | |
59 | 59 | ||
60 | 60 | let ErrorGameOver = "Game already is over " | |
61 | 61 | ||
62 | 62 | let ErrorIncorrectSectionResult = "Incorrect section result" | |
63 | 63 | ||
64 | 64 | let ErrorBetAmountNotInRange = "Bet amount is not in range" | |
65 | 65 | ||
66 | 66 | func StoreData (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func StoreDataInt (transactionId,key,value) = DataEntry(((transactionId + "_") + key), value) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func GetData (key) = match getString(this, key) { | |
73 | 73 | case str: String => | |
74 | 74 | str | |
75 | 75 | case _ => | |
76 | 76 | throw((ErrorKeyNotFound + key)) | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func GetDataString (transactionId,key) = { | |
81 | 81 | let fullKey = ((transactionId + "_") + key) | |
82 | 82 | match getString(this, fullKey) { | |
83 | 83 | case str: String => | |
84 | 84 | str | |
85 | 85 | case _ => | |
86 | 86 | throw((ErrorKeyNotFound + fullKey)) | |
87 | 87 | } | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func GetDataInt (transactionId,key) = { | |
92 | 92 | let fullKey = ((transactionId + "_") + key) | |
93 | 93 | match getInteger(this, fullKey) { | |
94 | 94 | case str: Int => | |
95 | 95 | str | |
96 | 96 | case _ => | |
97 | 97 | throw((ErrorKeyNotFound + fullKey)) | |
98 | 98 | } | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func NewGameId () = { | |
103 | 103 | let gameNum = match getInteger(this, DataGameNumberKey) { | |
104 | 104 | case num: Int => | |
105 | 105 | num | |
106 | 106 | case _ => | |
107 | 107 | 0 | |
108 | 108 | } | |
109 | 109 | (gameNum + 1) | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func GenerateRandInt (gameId,rsaSign) = { | |
114 | 114 | let rsaSigValid = sigVerify(fromBase58String(gameId), fromBase58String(rsaSign), ServerPublicKey) | |
115 | 115 | if (rsaSigValid) | |
116 | 116 | then { | |
117 | 117 | let rand = (toInt(sha256(toBytes(rsaSign))) % RouletteSections) | |
118 | 118 | if ((0 > rand)) | |
119 | 119 | then (-1 * rand) | |
120 | 120 | else rand | |
121 | 121 | } | |
122 | 122 | else throw("Invalid RSA signature") | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func GetStatus (result) = if (result) | |
127 | 127 | then DataStatusWin | |
128 | 128 | else DataStatusLoose | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func GetWinAmount (betAmt,section) = { | |
132 | 132 | let isCorrectResult = if (if (if (if ((section == 2)) | |
133 | 133 | then true | |
134 | 134 | else (section == 5)) | |
135 | 135 | then true | |
136 | 136 | else (section == 6)) | |
137 | 137 | then true | |
138 | 138 | else (section == 10)) | |
139 | 139 | then true | |
140 | 140 | else (section == 20) | |
141 | 141 | let betAmtValid = if (if (if (if ((betAmt == (BET1 + COMMISSION))) | |
142 | 142 | then true | |
143 | 143 | else (betAmt == (BET2 + COMMISSION))) | |
144 | 144 | then true | |
145 | 145 | else (betAmt == (BET4 + COMMISSION))) | |
146 | 146 | then true | |
147 | 147 | else (betAmt == (BET8 + COMMISSION))) | |
148 | 148 | then true | |
149 | 149 | else (betAmt == (BET14 + COMMISSION)) | |
150 | 150 | if (!(isCorrectResult)) | |
151 | 151 | then throw(ErrorIncorrectSectionResult) | |
152 | 152 | else if (betAmtValid) | |
153 | 153 | then ((betAmt - COMMISSION) * section) | |
154 | 154 | else throw(ErrorBetAmountNotInRange) | |
155 | 155 | } | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | @Callable(i) | |
159 | 159 | func bet (expectedResult) = { | |
160 | 160 | let gameNumber = NewGameId() | |
161 | 161 | let gameTransactionId = toBase58String(i.transactionId) | |
162 | 162 | let address = toBase58String(i.caller.bytes) | |
163 | 163 | let pmt = extract(i.payment) | |
164 | 164 | let txIdUsed = isDefined(getString(this, gameTransactionId)) | |
165 | 165 | let betNotInWaves = isDefined(pmt.assetId) | |
166 | 166 | let feeNotInWaves = isDefined(pmt.assetId) | |
167 | 167 | let amount = pmt.amount | |
168 | 168 | let winAmt = GetWinAmount(pmt.amount, expectedResult) | |
169 | 169 | if (betNotInWaves) | |
170 | 170 | then throw(ErrorBetMustBeInWaves) | |
171 | 171 | else if (feeNotInWaves) | |
172 | 172 | then throw(ErrorTransactionMustBeInWaves) | |
173 | 173 | else if (txIdUsed) | |
174 | 174 | then throw(ErrorTransactionUsed) | |
175 | 175 | else ScriptResult(WriteSet([DataEntry((DataUserGameKey + toString(gameNumber)), gameTransactionId), DataEntry(gameTransactionId, address), DataEntry(DataGameNumberKey, gameNumber), StoreDataInt(gameTransactionId, DataAmountKey, amount), StoreDataInt(gameTransactionId, DataSectionKey, expectedResult), StoreData(gameTransactionId, DataStatusKey, DataStatusNew), StoreDataInt(gameTransactionId, DataWinAmountKey, winAmt)]), TransferSet([ScriptTransfer(ServerAddress, COMMISSION, unit)])) | |
176 | 176 | } | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | ||
180 | 180 | @Callable(i) | |
181 | 181 | func result (gameTransactionId,rsa) = { | |
182 | 182 | let randIndex = GenerateRandInt(gameTransactionId, rsa) | |
183 | 183 | let selectedSection = GetDataInt(gameTransactionId, DataSectionKey) | |
184 | 184 | let status = GetDataString(gameTransactionId, DataStatusKey) | |
185 | 185 | if ((status == DataStatusNew)) | |
186 | 186 | then { | |
187 | 187 | let randSection = Sections[randIndex] | |
188 | 188 | let isWin = (randSection == selectedSection) | |
189 | 189 | let writeSet = WriteSet([StoreData(gameTransactionId, DataStatusKey, GetStatus(isWin)), StoreDataInt(gameTransactionId, DataResultKey, randSection)]) | |
190 | 190 | if (isWin) | |
191 | 191 | then { | |
192 | 192 | let wallet = GetData(gameTransactionId) | |
193 | 193 | let winAmount = GetDataInt(gameTransactionId, DataWinAmountKey) | |
194 | 194 | ScriptResult(writeSet, TransferSet([ScriptTransfer(addressFromStringValue(wallet), winAmount, unit)])) | |
195 | 195 | } | |
196 | 196 | else writeSet | |
197 | 197 | } | |
198 | 198 | else throw((ErrorGameOver + status)) | |
199 | 199 | } | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | @Verifier(tx) | |
203 | 203 | func verify () = if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
204 | 204 | then match tx { | |
205 | 205 | case ttx: TransferTransaction => | |
206 | 206 | true | |
207 | 207 | case stx: SetScriptTransaction => | |
208 | 208 | true | |
209 | 209 | case _ => | |
210 | 210 | false | |
211 | 211 | } | |
212 | 212 | else false | |
213 | 213 |
github/deemru/w8io/169f3d6 38.29 ms ◑