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