tx · 6d8wCYCfYLTGm2pvPSAMeBE8XVbSDyhscX2ZcT3T2KAh 3MvL5pLQjfYohUVZK9yXuvZCqRetSDVjRd7: -0.01000000 Waves 2019.08.30 16:20 [654038] smart account 3MvL5pLQjfYohUVZK9yXuvZCqRetSDVjRd7 > SELF 0.00000000 Waves
{ "type": 13, "id": "6d8wCYCfYLTGm2pvPSAMeBE8XVbSDyhscX2ZcT3T2KAh", "fee": 1000000, "feeAssetId": null, "timestamp": 1567171205773, "version": 1, "sender": "3MvL5pLQjfYohUVZK9yXuvZCqRetSDVjRd7", "senderPublicKey": "FnkW9DPqDdbYRQRkebxoeKK5rhbQT2oejwxL1JZKxnjx", "proofs": [ "4fTEnw5hYePdgcPHnLig9Ew1XpN9xuR7nGtdaHSTqCbqtz3kZT5nHM8QTsLgWUKFGZ9d148Scekb5bfMtWoB5a1d" ], "script": "base64:AAIDAAAAAAAAAAAAAAAUAAAAAApiZXRBc3NldElkAQAAACCOzwd0wFauq1oyFNNvfYKq/bZScvC/NuqxJOsrt3qFuQAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAAZtaW5CZXQAAAAAAABMS0AAAAAAD21pbk1hdGNoTm9taW5hbAAAAAAAAExLQAAAAAAGbGV2ZWwxAAAAAAAAAAD6AAAAAAZsZXZlbDIAAAAAAAAAAJYAAAAABmxldmVsMwAAAAAAAAAAZAAAAAAIY2FzaEJhY2sAAAAAAAAAAfQAAAAACHRvdGFsUmVmAAAAAAAAAAAKAAAAAA1jaGFuZ2VBZGRyZXNzAgAAACMzTkF4c2JIeFM2M2F6ZEFpY1Z2TEdzeGpBUTlEc0s2TDROTAAAAAALbWluV2l0aGRyYXcAAAAAAAAPQkABAAAAE2dldENhbGxlckJ5RGVsZWdhdGUAAAACAAAAAWkAAAAIZnVuY3Rpb24EAAAABmNhbGxlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAxjYWxsZXJQcmVmaXgJAAEsAAAAAgIAAAAJ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ZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkAAGQAAAACBQAAAAZhbW91bnQIBQAAAAFpAAAAA2ZlZQUAAAAEdW5pdAUAAAADbmlsAAAAAWkBAAAACHJlZ2lzdGVyAAAAAgAAAAdyZWZlcmVyAAAABHNhbHQDCQEAAAABIQAAAAEJAQAAAAhjaGVja0ZlZQAAAAEFAAAAAWkJAAACAAAAAQIAAAAFZXJyb3IDCQEAAAACIT0AAAACCQABLwAAAAIJAAJYAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAAAAAAAAAAAAwIAAAADMTIzCQAAAgAAAAECAAAAFHByb29mIG9mIHdvcmsgZmFpbGVkBAAAAAVvd25lcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAwkBAAAACWlzRGVmaW5lZAAAAAEJAQAAAApnZXRSZWZlcmVyAAAAAQUAAAAFb3duZXIJAAACAAAAAQIAAAASQWxyZWFkeSByZWdpc3RlcmVkCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAVvd25lcgIAAAAIX3JlZmVyZXIFAAAAB3JlZmVyZXIJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAdyZWZlcmVyAgAAAApfcmVmZXJyYWxfBQAAAAVvd25lcgUAAAAFb3duZXIFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIIBQAAAAFpAAAAA2ZlZQUAAAAEdW5pdAUAAAADbmlsAAAAAL/KOc4=", "chainId": 84, "height": 654038, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let betAssetId = base58'AcTzTgW1QbJK4Qu6hCsUCLjpxUyD3dofv8xq2CAPbzKJ' | |
5 | + | ||
6 | + | let maxFee = 5000000 | |
7 | + | ||
8 | + | let minBet = 5000000 | |
9 | + | ||
10 | + | let minMatchNominal = 5000000 | |
11 | + | ||
12 | + | let level1 = 250 | |
13 | + | ||
14 | + | let level2 = 150 | |
15 | + | ||
16 | + | let level3 = 100 | |
17 | + | ||
18 | + | let cashBack = 500 | |
19 | + | ||
20 | + | let totalRef = 10 | |
21 | + | ||
22 | + | let changeAddress = "3NAxsbHxS63azdAicVvLGsxjAQ9DsK6L4NL" | |
23 | + | ||
24 | + | let minWithdraw = 1000000 | |
25 | + | ||
26 | + | func getCallerByDelegate (i,function) = { | |
27 | + | let caller = toBase58String(i.caller.bytes) | |
28 | + | let callerPrefix = ("delegate_" + caller) | |
29 | + | if ((getBoolean(this, ((callerPrefix + "_") + function)) == true)) | |
30 | + | then match getString(this, (callerPrefix + "_address")) { | |
31 | + | case s: String => | |
32 | + | s | |
33 | + | case _ => | |
34 | + | caller | |
35 | + | } | |
36 | + | else caller | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | func checkFee (i) = if ((i.fee > maxFee)) | |
41 | + | then throw("unreasonable large fee") | |
42 | + | else if ((i.feeAssetId != unit)) | |
43 | + | then throw("fee must be in WAVES") | |
44 | + | else true | |
45 | + | ||
46 | + | ||
47 | + | func repayFee (i,ws,amount,recipient) = if (checkFee(i)) | |
48 | + | then if (if ((amount > 0)) | |
49 | + | then isDefined(recipient) | |
50 | + | else false) | |
51 | + | then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(extract(recipient), amount, betAssetId)])) | |
52 | + | else ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit)])) | |
53 | + | else throw("error") | |
54 | + | ||
55 | + | ||
56 | + | func checkOwner (i,betid) = (getString(this, (betid + "_owner")) == toBase58String(i.caller.bytes)) | |
57 | + | ||
58 | + | ||
59 | + | func getUnspent (betid) = (extract(getInteger(this, (betid + "_amount"))) - extract(getInteger(this, (betid + "_spent")))) | |
60 | + | ||
61 | + | ||
62 | + | func isDefeated (betid) = { | |
63 | + | let defeatStatus = getInteger(this, (betid + "_defeat")) | |
64 | + | if ((defeatStatus == 1)) | |
65 | + | then true | |
66 | + | else (defeatStatus == 3) | |
67 | + | } | |
68 | + | ||
69 | + | ||
70 | + | func getReferer (user) = getString(this, (user + "_referer")) | |
71 | + | ||
72 | + | ||
73 | + | func balanceIncrement (address,inc) = { | |
74 | + | let balanceKey = (address + "_balance") | |
75 | + | DataEntry(balanceKey, (inc + match getInteger(this, balanceKey) { | |
76 | + | case b: Int => | |
77 | + | b | |
78 | + | case _ => | |
79 | + | 0 | |
80 | + | })) | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | func recordBalanceIncrement (address,owner,inc,level,txId,timestamp) = DataEntry(((("fund_" + address) + "_") + txId), ((((((owner + ":") + toString(inc)) + ":") + level) + ":") + timestamp)) | |
85 | + | ||
86 | + | ||
87 | + | @Callable(i) | |
88 | + | func bet (event,subevent,side,odds) = { | |
89 | + | let owner = toBase58String(i.caller.bytes) | |
90 | + | let payment = extract(i.payment) | |
91 | + | if ((payment.assetId != betAssetId)) | |
92 | + | then throw(("bet must be in asset " + toBase58String(betAssetId))) | |
93 | + | else if ((minBet > payment.amount)) | |
94 | + | then throw(("minimum allowed bet is " + toString(minBet))) | |
95 | + | else if (if ((side != "for")) | |
96 | + | then (side != "against") | |
97 | + | else false) | |
98 | + | then throw("unexpected side") | |
99 | + | else { | |
100 | + | let betid = (((((("bet_" + event) + "_") + toBase58String(i.caller.bytes)) + "_") + take(toBase58String(i.transactionId), 15)) + "_") | |
101 | + | let sequenceKey = ((("seq_" + event) + "_") + subevent) | |
102 | + | let sequence = match getInteger(this, sequenceKey) { | |
103 | + | case prevS: Int => | |
104 | + | (prevS + 1) | |
105 | + | case _ => | |
106 | + | 1 | |
107 | + | } | |
108 | + | repayFee(i, WriteSet([DataEntry((betid + "owner"), owner), DataEntry((betid + "event"), event), DataEntry((betid + "subevent"), subevent), DataEntry((betid + "side"), side), DataEntry((betid + "odds"), odds), DataEntry((betid + "amount"), payment.amount), DataEntry((betid + "spent"), 0), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)]), 0, unit) | |
109 | + | } | |
110 | + | } | |
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | @Callable(i) | |
115 | + | func cancel (betid) = if ((getString(this, (betid + "_owner")) != getCallerByDelegate(i, "autocancel"))) | |
116 | + | then throw("must be owner or its delegate to cancel") | |
117 | + | else { | |
118 | + | let amount = extract(getInteger(this, (betid + "_amount"))) | |
119 | + | let spent = extract(getInteger(this, (betid + "_spent"))) | |
120 | + | let cancelAmount = (amount - spent) | |
121 | + | repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount, i.caller) | |
122 | + | } | |
123 | + | ||
124 | + | ||
125 | + | ||
126 | + | @Callable(i) | |
127 | + | func betMatch (betFor,betAgainst) = if ((getString(this, (betFor + "_event")) != getString(this, (betAgainst + "_event")))) | |
128 | + | then throw("event id must match") | |
129 | + | else if ((getString(this, (betFor + "_subevent")) != getString(this, (betAgainst + "_subevent")))) | |
130 | + | then throw("subevent id must match") | |
131 | + | else if ((getString(this, (betFor + "_side")) != "for")) | |
132 | + | then throw("invalid *for* bet") | |
133 | + | else if ((getString(this, (betAgainst + "_side")) != "against")) | |
134 | + | then throw("invalid *against* bet") | |
135 | + | else { | |
136 | + | let betForOwner = getStringValue(this, (betFor + "_owner")) | |
137 | + | let betAgainstOwner = getStringValue(this, (betAgainst + "_owner")) | |
138 | + | let eventid = extract(getString(this, (betFor + "_event"))) | |
139 | + | let matchid = (((((((("match_" + eventid) + "_") + takeRight(betForOwner, 10)) + "_") + takeRight(betAgainstOwner, 10)) + "_") + toBase58String(i.transactionId)) + "_") | |
140 | + | let odds = extract(getInteger(this, (betFor + "_odds"))) | |
141 | + | let unspentFor = getUnspent(betFor) | |
142 | + | let unspentAgainst = getUnspent(betAgainst) | |
143 | + | let maxForNominal = unspentFor | |
144 | + | let maxAgainstNominal = ((unspentAgainst * 100) / (odds - 100)) | |
145 | + | let matchNominal = if ((maxForNominal > maxAgainstNominal)) | |
146 | + | then maxAgainstNominal | |
147 | + | else maxForNominal | |
148 | + | if ((minMatchNominal > matchNominal)) | |
149 | + | then throw("match nominal too low") | |
150 | + | else { | |
151 | + | let spendFor = matchNominal | |
152 | + | let spendAgainst = ((matchNominal * (odds - 100)) / 100) | |
153 | + | let newSpentFor = (spendFor + extract(getInteger(this, (betFor + "_spent")))) | |
154 | + | let newSpentAgainst = (spendAgainst + extract(getInteger(this, (betAgainst + "_spent")))) | |
155 | + | if ((newSpentFor > extract(getInteger(this, (betFor + "_amount"))))) | |
156 | + | then throw("invalid match") | |
157 | + | else if ((newSpentAgainst > extract(getInteger(this, (betAgainst + "_amount"))))) | |
158 | + | then throw("invalid match") | |
159 | + | else repayFee(i, WriteSet([DataEntry((matchid + "amount"), (spendFor + spendAgainst)), DataEntry((matchid + "for"), betFor), DataEntry((matchid + "against"), betAgainst), DataEntry((betFor + "_spent"), newSpentFor), DataEntry((betAgainst + "_spent"), newSpentAgainst)]), 0, unit) | |
160 | + | } | |
161 | + | } | |
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | @Callable(i) | |
166 | + | func approveDefeat (betId,defeat) = if (if (isDefined(getInteger(this, (betId + "_defeat")))) | |
167 | + | then (defeat == 2) | |
168 | + | else false) | |
169 | + | then throw("can't dispute after approve") | |
170 | + | else if ((getString(this, (betId + "_owner")) != getCallerByDelegate(i, "autoapprove"))) | |
171 | + | then throw("must be owner or its delegate to approve") | |
172 | + | else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit) | |
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | @Callable(i) | |
177 | + | func payWinner (matchId) = if (!(checkFee(i))) | |
178 | + | then throw("error") | |
179 | + | else if (isDefined(getInteger(this, (matchId + "_paid")))) | |
180 | + | then throw("already paid") | |
181 | + | else { | |
182 | + | let betForId = extract(getString(this, (matchId + "_for"))) | |
183 | + | let betAgainstId = extract(getString(this, (matchId + "_against"))) | |
184 | + | let betForDefeated = isDefeated(betForId) | |
185 | + | let betAgainstDefeated = isDefeated(betAgainstId) | |
186 | + | if (if (!(betForDefeated)) | |
187 | + | then !(betAgainstDefeated) | |
188 | + | else false) | |
189 | + | then throw("no side approved defeat") | |
190 | + | else { | |
191 | + | let winnerId = if (betForDefeated) | |
192 | + | then betAgainstId | |
193 | + | else betForId | |
194 | + | let winnerAddress = getStringValue(this, (winnerId + "_owner")) | |
195 | + | let amount = extract(getInteger(this, (matchId + "_amount"))) | |
196 | + | let txid = toBase58String(i.transactionId) | |
197 | + | let timestamp = toString(lastBlock.timestamp) | |
198 | + | let refAmount = ((amount * totalRef) / 1000) | |
199 | + | ScriptResult(WriteSet([DataEntry((matchId + "_paid"), toBase58String(i.transactionId)), match getReferer(winnerAddress) { | |
200 | + | case ref1: String => | |
201 | + | let incLevel1 = ((refAmount * level1) / 1000) | |
202 | + | let incCashBack = ((refAmount * cashBack) / 1000) | |
203 | + | [balanceIncrement(winnerAddress, incCashBack), recordBalanceIncrement(winnerAddress, winnerAddress, incCashBack, "cashback", txid, timestamp), balanceIncrement(ref1, incLevel1), recordBalanceIncrement(ref1, winnerAddress, incLevel1, "l1", txid, timestamp), match getReferer(ref1) { | |
204 | + | case ref2: String => | |
205 | + | let incLevel2 = ((refAmount * level2) / 1000) | |
206 | + | [balanceIncrement(ref2, incLevel2), recordBalanceIncrement(ref2, winnerAddress, incLevel2, "l2", txid, timestamp), match getReferer(ref2) { | |
207 | + | case ref3: String => | |
208 | + | let incLevel3 = ((refAmount * level3) / 1000) | |
209 | + | [balanceIncrement(ref3, incLevel3), recordBalanceIncrement(ref3, winnerAddress, incLevel3, "l3", txid, timestamp), balanceIncrement(changeAddress, (((refAmount - incLevel1) - incLevel2) - incLevel3)), recordBalanceIncrement(changeAddress, winnerAddress, (((refAmount - incLevel1) - incLevel2) - incLevel3), "change", txid, timestamp)] | |
210 | + | case _ => | |
211 | + | [balanceIncrement(changeAddress, ((refAmount - incLevel1) - incLevel2)), recordBalanceIncrement(changeAddress, winnerAddress, ((refAmount - incLevel1) - incLevel2), "change", txid, timestamp)] | |
212 | + | }] | |
213 | + | case _ => | |
214 | + | [balanceIncrement(changeAddress, (refAmount - incLevel1)), recordBalanceIncrement(changeAddress, winnerAddress, (refAmount - incLevel1), "change", txid, timestamp)] | |
215 | + | }] | |
216 | + | case _ => | |
217 | + | [balanceIncrement(changeAddress, refAmount), recordBalanceIncrement(changeAddress, winnerAddress, refAmount, "change", txid, timestamp)] | |
218 | + | }]), TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(addressFromStringValue(winnerAddress), (amount - refAmount), betAssetId)])) | |
219 | + | } | |
220 | + | } | |
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | @Callable(i) | |
225 | + | func delegate (delegateTo,enableAutoApprove,enableAutoCancel) = repayFee(i, WriteSet([DataEntry((("delegate_" + delegateTo) + "_address"), toBase58String(i.caller.bytes)), DataEntry((("delegate_" + delegateTo) + "_autoapprove"), enableAutoApprove), DataEntry((("delegate_" + delegateTo) + "_autocancel"), enableAutoCancel)]), 0, unit) | |
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | @Callable(i) | |
230 | + | func withdraw () = if (!(checkFee(i))) | |
231 | + | then throw("error") | |
232 | + | else { | |
233 | + | let owner = toBase58String(i.caller.bytes) | |
234 | + | let txid = toBase58String(i.transactionId) | |
235 | + | let balanceKey = (owner + "_balance") | |
236 | + | let amount = match getInteger(this, balanceKey) { | |
237 | + | case b: Int => | |
238 | + | b | |
239 | + | case _ => | |
240 | + | 0 | |
241 | + | } | |
242 | + | if ((minWithdraw > amount)) | |
243 | + | then throw(("Min withdraw amount is" + toString(minWithdraw))) | |
244 | + | else ScriptResult(WriteSet([DataEntry(balanceKey, 0), DataEntry(((("withdraw_" + owner) + "_") + txid), ((toString(amount) + ":") + toString(lastBlock.timestamp)))]), TransferSet([ScriptTransfer(i.caller, (amount + i.fee), unit)])) | |
245 | + | } | |
246 | + | ||
247 | + | ||
248 | + | ||
249 | + | @Callable(i) | |
250 | + | func register (referer,salt) = if (!(checkFee(i))) | |
251 | + | then throw("error") | |
252 | + | else if ((take(toBase58String(i.transactionId), 3) != "123")) | |
253 | + | then throw("proof of work failed") | |
254 | + | else { | |
255 | + | let owner = toBase58String(i.caller.bytes) | |
256 | + | if (isDefined(getReferer(owner))) | |
257 | + | then throw("Already registered") | |
258 | + | else ScriptResult(WriteSet([DataEntry((owner + "_referer"), referer), DataEntry(((referer + "_referral_") + owner), owner)]), TransferSet([ScriptTransfer(i.caller, i.fee, unit)])) | |
259 | + | } | |
260 | + | ||
261 | + |
github/deemru/w8io/169f3d6 42.03 ms ◑