tx · 3kPjwHSdoq3L1w8q1y1ayWfjiH9StXL3KmK3qo5T21uJ 3MpBKNSG25gK9fufNK3tjRAnpD83mXYZog6: -0.01400000 Waves 2019.10.05 11:56 [706226] smart account 3MpBKNSG25gK9fufNK3tjRAnpD83mXYZog6 > SELF 0.00000000 Waves
{ "type": 13, "id": "3kPjwHSdoq3L1w8q1y1ayWfjiH9StXL3KmK3qo5T21uJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1570265725388, "version": 1, "sender": "3MpBKNSG25gK9fufNK3tjRAnpD83mXYZog6", "senderPublicKey": "qqthrzfmAnD7FmWuFzzm3FbACout7pi6sYqHmXc2Hyc", "proofs": [ "5nKH9WfQfBATRnhZeX5rV7PapWhH9DrN5upu68uYr8kL3tMtAZKyzEge2AoSBRQ9brrUGeUFMQ7AmMTfcFRGuZ39" ], "script": "base64:AAIDAAAAAAAAADgIARIHCgUICAgBCBIDCgEIEgQKAggIEgQKAggBEgMKAQgSAwoBCBIFCgMIBAQSAwoBCBIECgIIAQAAABwAAAAAC2JldEFzc2V0SWRzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAZzcG9ydHICAAAALEZ0OFgxdjFMVGExQUJhZnVmcGFDV3lWajhLa2F4VVdFNnhCaFc2c05GSmNrCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAANkZXgCAAAABVdBVkVTBQAAAANuaWwAAAAAEWJldEFzc2V0TW5lbW9uaWNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAZzcG9ydHICAAAAA1VTRAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAADZGV4AgAAAAVXQVZFUwUAAAADbmlsAAAAAA5hc3NldHNEZWNpbWFscwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAADVVNEAAAAAAAAAAACCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAVXQVZFUwAAAAAAAAAACAkABEwAAAACCQEAA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EsAAAAAgUAAAAFb3duZXICAAAACF9yZWZlcmVyBQAAAAdyZWZlcmVyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAHcmVmZXJlcgIAAAAKX3JlZmVycmFsXwUAAAAFb3duZXIFAAAABW93bmVyBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyCAUAAAABaQAAAANmZWUFAAAABHVuaXQFAAAAA25pbAAAAADz66S3", "chainId": 84, "height": 706226, "spentComplexity": 0 } View: original | compacted Prev: ASMBngEuo9NLAjqWth2yJHqAqDq3Tmv6i9uCt6FEA6a7 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let betAssetIds = [DataEntry("sportr", " | |
4 | + | let betAssetIds = [DataEntry("sportr", "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"), DataEntry("dex", "WAVES")] | |
5 | 5 | ||
6 | - | let dexAgent = addressFromStringValue("3NCN79gCSaKTFV6fDoEzELoxDMrAUTCekd5") | |
6 | + | let betAssetMnemonics = [DataEntry("sportr", "USD"), DataEntry("dex", "WAVES")] | |
7 | + | ||
8 | + | let assetsDecimals = [DataEntry("USD", 2), DataEntry("WAVES", 8), DataEntry("BTC", 8), DataEntry("VST", 8)] | |
9 | + | ||
10 | + | let dexAgent = addressFromStringValue("3P69jzek6S2q7kGWScEEZaNxKL5TiSF7wGm") | |
11 | + | ||
12 | + | let changeAddress = "3PQexcLjbv9CsYbt6zKF7nfEppf2gKHCEkz" | |
7 | 13 | ||
8 | 14 | let maxFee = 5000000 | |
9 | 15 | ||
10 | - | let minBet = 5000000 | |
11 | - | ||
12 | 16 | let minCreateEvent = 30000000 | |
13 | - | ||
14 | - | let minMatchNominal = 5000000 | |
15 | 17 | ||
16 | 18 | let dexJudgeGraceTs = ((1000 * 60) * 5) | |
17 | 19 | ||
25 | 27 | ||
26 | 28 | let totalRef = 10 | |
27 | 29 | ||
28 | - | let | |
30 | + | let minWithdraw = 1000000 | |
29 | 31 | ||
30 | - | let minWithdraw = 1000000 | |
32 | + | func getAssetIdByName (name) = { | |
33 | + | let assetIdByName = [DataEntry("USD", base58'Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck'), DataEntry("BTC", base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS'), DataEntry("VST", base58'4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8')] | |
34 | + | if ((name == "WAVES")) | |
35 | + | then unit | |
36 | + | else getBinaryValue(assetIdByName, name) | |
37 | + | } | |
38 | + | ||
31 | 39 | ||
32 | 40 | func getCallerByDelegate (i,function) = { | |
33 | 41 | let caller = toBase58String(i.caller.bytes) | |
76 | 84 | func getReferer (user) = getString(this, (user + "_referer")) | |
77 | 85 | ||
78 | 86 | ||
79 | - | func balanceIncrement (address,inc) = { | |
80 | - | let balanceKey = (address + "_balance") | |
87 | + | func balanceIncrement (address,asset,inc) = { | |
88 | + | let balanceKey = (((address + "_") + asset) + "_balance") | |
81 | 89 | DataEntry(balanceKey, (inc + match getInteger(this, balanceKey) { | |
82 | 90 | case b: Int => | |
83 | 91 | b | |
87 | 95 | } | |
88 | 96 | ||
89 | 97 | ||
90 | - | func recordBalanceIncrement (address,owner,inc,level,txId,timestamp) = DataEntry(((("fund_" + address) + "_") + txId), | |
98 | + | func recordBalanceIncrement (address,asset,owner,inc,level,txId,timestamp) = DataEntry(((((((("fund_" + address) + "_") + asset) + "_") + level) + "_") + txId), ((((owner + ":") + toString(inc)) + ":") + timestamp)) | |
91 | 99 | ||
92 | 100 | ||
93 | 101 | func getAssetByAdapter (adapter) = { | |
96 | 104 | then unit | |
97 | 105 | else fromBase58String(assetString) | |
98 | 106 | } | |
107 | + | ||
108 | + | ||
109 | + | func getMinBetByAdapter (adapter) = getIntegerValue([DataEntry("dex", 5000000), DataEntry("sportr", 100)], adapter) | |
110 | + | ||
111 | + | ||
112 | + | func getMinMatchByAdapter (adapter) = getIntegerValue([DataEntry("dex", 1000000), DataEntry("sportr", 1)], adapter) | |
99 | 113 | ||
100 | 114 | ||
101 | 115 | func getAssetMnemonic (asset) = if ((asset == unit)) | |
107 | 121 | func bet (event,subevent,side,odds,adapter) = { | |
108 | 122 | let marketKey = ("market_" + event) | |
109 | 123 | let betAssetId = getAssetByAdapter(adapter) | |
124 | + | let betAssetMnemonic = getStringValue(betAssetIds, adapter) | |
110 | 125 | let owner = toBase58String(i.caller.bytes) | |
111 | 126 | let payment = extract(i.payment) | |
112 | 127 | if ((payment.assetId != betAssetId)) | |
113 | - | then throw(((("bet must be in asset " + getAssetMnemonic(betAssetId)) + " for adapter ") + adapter)) | |
114 | - | else if ((minBet > payment.amount)) | |
115 | - | then throw(("minimum allowed bet is " + toString(minBet))) | |
116 | - | else if (if (if ((adapter == "dex")) | |
117 | - | then (minCreateEvent > payment.amount) | |
118 | - | else false) | |
119 | - | then (getBoolean(this, marketKey) == unit) | |
120 | - | else false) | |
121 | - | then throw(("min amount to create first bet is " + toString(minCreateEvent))) | |
122 | - | else if (if ((side != "for")) | |
123 | - | then (side != "against") | |
128 | + | then throw(((("bet must be in asset " + betAssetMnemonic) + " for adapter ") + adapter)) | |
129 | + | else { | |
130 | + | let minBet = getMinBetByAdapter(adapter) | |
131 | + | if ((minBet > payment.amount)) | |
132 | + | then throw(("minimum allowed bet is " + toString(minBet))) | |
133 | + | else if (if (if ((adapter == "dex")) | |
134 | + | then (minCreateEvent > payment.amount) | |
124 | 135 | else false) | |
125 | - | then throw("unexpected side") | |
126 | - | else { | |
127 | - | let betid = (((((("bet_" + event) + "_") + toBase58String(i.caller.bytes)) + "_") + take(toBase58String(i.transactionId), 5)) + "_") | |
128 | - | let sequenceKey = ((("seq_" + event) + "_") + subevent) | |
129 | - | let sequence = match getInteger(this, sequenceKey) { | |
130 | - | case prevS: Int => | |
131 | - | (prevS + 1) | |
132 | - | case _ => | |
133 | - | 1 | |
134 | - | } | |
135 | - | 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 + "adapter"), adapter), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(marketKey, true), DataEntry(sequenceKey, sequence)]), 0, unit, unit) | |
136 | - | } | |
136 | + | then (getBoolean(this, marketKey) == unit) | |
137 | + | else false) | |
138 | + | then throw(("min amount to create first bet is " + toString(minCreateEvent))) | |
139 | + | else if (if ((side != "for")) | |
140 | + | then (side != "against") | |
141 | + | else false) | |
142 | + | then throw("unexpected side") | |
143 | + | else { | |
144 | + | let betid = (((((("bet_" + event) + "_") + owner) + "_") + take(toBase58String(i.transactionId), 5)) + "_") | |
145 | + | let sequenceKey = ((("seq_" + event) + "_") + subevent) | |
146 | + | let sequence = match getInteger(this, sequenceKey) { | |
147 | + | case prevS: Int => | |
148 | + | (prevS + 1) | |
149 | + | case _ => | |
150 | + | 1 | |
151 | + | } | |
152 | + | let commonRecords = [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 + "adapter"), adapter), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)] | |
153 | + | let allRecords = if ((adapter == "dex")) | |
154 | + | then DataEntry(marketKey, true) :: commonRecords | |
155 | + | else commonRecords | |
156 | + | repayFee(i, WriteSet(allRecords), 0, unit, unit) | |
157 | + | } | |
158 | + | } | |
137 | 159 | } | |
138 | 160 | ||
139 | 161 | ||
165 | 187 | if ((adapter != getStringValue(this, (betAgainst + "_adapter")))) | |
166 | 188 | then throw("bets has different adapters") | |
167 | 189 | else { | |
190 | + | let minMatchNominal = getMinMatchByAdapter(adapter) | |
168 | 191 | let betForOwner = getStringValue(this, (betFor + "_owner")) | |
169 | 192 | let betAgainstOwner = getStringValue(this, (betAgainst + "_owner")) | |
170 | 193 | let eventid = extract(getString(this, (betFor + "_event"))) | |
196 | 219 | ||
197 | 220 | ||
198 | 221 | @Callable(i) | |
199 | - | func approveDefeat (betId,defeat) = if (if (isDefined(getInteger(this, (betId + "_defeat")))) | |
200 | - | then (defeat == 2) | |
201 | - | else false) | |
202 | - | then throw("can't dispute after approve") | |
203 | - | else if ((getString(this, (betId + "_owner")) != getCallerByDelegate(i, "autoapprove"))) | |
204 | - | then throw("must be owner or its delegate to approve") | |
205 | - | else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit, unit) | |
222 | + | func approveDefeat (betId,defeat) = { | |
223 | + | let a = extract(assetInfo(base58'')) | |
224 | + | if (if (isDefined(getInteger(this, (betId + "_defeat")))) | |
225 | + | then (defeat == 2) | |
226 | + | else false) | |
227 | + | then throw("can't dispute after approve") | |
228 | + | else if ((getString(this, (betId + "_owner")) != getCallerByDelegate(i, "autoapprove"))) | |
229 | + | then throw("must be owner or its delegate to approve") | |
230 | + | else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit, unit) | |
231 | + | } | |
206 | 232 | ||
207 | 233 | ||
208 | 234 | ||
219 | 245 | let pair = eventS[1] | |
220 | 246 | let eventRate = parseIntValue(eventS[2]) | |
221 | 247 | let eventTs = parseIntValue(eventS[3]) | |
248 | + | let pairSplit = split(pair, "/") | |
249 | + | let pairDecimals1 = getIntegerValue(assetsDecimals, pairSplit[0]) | |
250 | + | let pairDecimals2 = getIntegerValue(assetsDecimals, pairSplit[1]) | |
251 | + | let rateCorrectionPower = (pairDecimals1 - pairDecimals2) | |
252 | + | let rateCorrection = if ((rateCorrectionPower == 0)) | |
253 | + | then 1 | |
254 | + | else if ((rateCorrectionPower == 1)) | |
255 | + | then 10 | |
256 | + | else if ((rateCorrectionPower == 2)) | |
257 | + | then 100 | |
258 | + | else if ((rateCorrectionPower == 3)) | |
259 | + | then 1000 | |
260 | + | else if ((rateCorrectionPower == 4)) | |
261 | + | then 10000 | |
262 | + | else if ((rateCorrectionPower == 5)) | |
263 | + | then 100000 | |
264 | + | else if ((rateCorrectionPower == 6)) | |
265 | + | then 1000000 | |
266 | + | else if ((rateCorrectionPower == 7)) | |
267 | + | then 10000000 | |
268 | + | else if ((rateCorrectionPower == 8)) | |
269 | + | then 100000000 | |
270 | + | else throw("unsupported") | |
222 | 271 | let judgeTs = ((eventTs * 1000) + dexJudgeGraceTs) | |
223 | 272 | if ((judgeTs > lastBlock.timestamp)) | |
224 | 273 | then throw(("please wait for timestamp " + toString(judgeTs))) | |
227 | 276 | if (!(isDefined(rateFromAgent))) | |
228 | 277 | then throw("rate from agent not ready yet") | |
229 | 278 | else { | |
230 | - | let looserBet = if ((extract(rateFromAgent) > | |
279 | + | let looserBet = if (((extract(rateFromAgent) * rateCorrection) > eventRate)) | |
231 | 280 | then betAgainst | |
232 | 281 | else betFor | |
233 | 282 | repayFee(i, WriteSet([DataEntry((looserBet + "_defeat"), 1), DataEntry((matchId + "_judged"), true)]), 0, unit, unit) | |
240 | 289 | @Callable(i) | |
241 | 290 | func payWinner (matchId) = if (!(checkFee(i))) | |
242 | 291 | then throw("error") | |
243 | - | else if (isDefined( | |
292 | + | else if (isDefined(getString(this, (matchId + "_paid")))) | |
244 | 293 | then throw("already paid") | |
245 | 294 | else { | |
246 | 295 | let adapter = getStringValue(this, (matchId + "_adapter")) | |
247 | 296 | let betAssetId = getAssetByAdapter(adapter) | |
297 | + | let betAssetMnemonic = getStringValue(betAssetMnemonics, adapter) | |
248 | 298 | let betForId = extract(getString(this, (matchId + "_for"))) | |
249 | 299 | let betAgainstId = extract(getString(this, (matchId + "_against"))) | |
250 | 300 | let betForDefeated = isDefeated(betForId) | |
266 | 316 | case ref1: String => | |
267 | 317 | let incLevel1 = ((refAmount * level1) / 1000) | |
268 | 318 | let incCashBack = ((refAmount * cashBack) / 1000) | |
269 | - | [balanceIncrement(winnerAddress, incCashBack), recordBalanceIncrement(winnerAddress, winnerAddress, incCashBack, "cashback", txid, timestamp), balanceIncrement(ref1, incLevel1), recordBalanceIncrement(ref1, winnerAddress, incLevel1, "l1", txid, timestamp), match getReferer(ref1) { | |
319 | + | [balanceIncrement(winnerAddress, betAssetMnemonic, incCashBack), recordBalanceIncrement(winnerAddress, betAssetMnemonic, winnerAddress, incCashBack, "cashback", txid, timestamp), balanceIncrement(ref1, betAssetMnemonic, incLevel1), recordBalanceIncrement(ref1, betAssetMnemonic, winnerAddress, incLevel1, "l1", txid, timestamp), match getReferer(ref1) { | |
270 | 320 | case ref2: String => | |
271 | 321 | let incLevel2 = ((refAmount * level2) / 1000) | |
272 | - | [balanceIncrement(ref2, incLevel2), recordBalanceIncrement(ref2, winnerAddress, incLevel2, "l2", txid, timestamp), match getReferer(ref2) { | |
273 | - | case ref3: String => | |
274 | - | let incLevel3 = ((refAmount * level3) / 1000) | |
275 | - | [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)] | |
322 | + | [balanceIncrement(ref2, betAssetMnemonic, incLevel2), recordBalanceIncrement(ref2, betAssetMnemonic, winnerAddress, incLevel2, "l2", txid, timestamp), match getReferer(ref2) { | |
276 | 323 | case _ => | |
277 | - | [balanceIncrement(changeAddress, ((refAmount - incLevel1) - incLevel2)), recordBalanceIncrement(changeAddress, winnerAddress, ((refAmount - incLevel1) - incLevel2), "change", txid, timestamp)] | |
324 | + | [balanceIncrement(changeAddress, betAssetMnemonic, ((refAmount - incLevel1) - incLevel2)), recordBalanceIncrement(changeAddress, betAssetMnemonic, winnerAddress, ((refAmount - incLevel1) - incLevel2), "change", txid, timestamp)] | |
278 | 325 | }] | |
279 | 326 | case _ => | |
280 | - | [balanceIncrement(changeAddress, (refAmount - incLevel1)), recordBalanceIncrement(changeAddress, winnerAddress, (refAmount - incLevel1), "change", txid, timestamp)] | |
327 | + | [balanceIncrement(changeAddress, betAssetMnemonic, (refAmount - incLevel1)), recordBalanceIncrement(changeAddress, betAssetMnemonic, winnerAddress, (refAmount - incLevel1), "change", txid, timestamp)] | |
281 | 328 | }] | |
282 | 329 | case _ => | |
283 | - | [balanceIncrement(changeAddress, refAmount), recordBalanceIncrement(changeAddress, winnerAddress, refAmount, "change", txid, timestamp)] | |
330 | + | [balanceIncrement(changeAddress, betAssetMnemonic, refAmount), recordBalanceIncrement(changeAddress, betAssetMnemonic, winnerAddress, refAmount, "change", txid, timestamp)] | |
284 | 331 | }]), TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(addressFromStringValue(winnerAddress), (amount - refAmount), betAssetId)])) | |
285 | 332 | } | |
286 | 333 | } | |
293 | 340 | ||
294 | 341 | ||
295 | 342 | @Callable(i) | |
296 | - | func withdraw () = if (!(checkFee(i))) | |
343 | + | func withdraw (assetName) = if (!(checkFee(i))) | |
297 | 344 | then throw("error") | |
298 | 345 | else { | |
299 | 346 | let owner = toBase58String(i.caller.bytes) | |
300 | 347 | let txid = toBase58String(i.transactionId) | |
301 | - | let balanceKey = (owner + "_balance") | |
348 | + | let balanceKey = (((owner + "_") + assetName) + "_balance") | |
349 | + | let assetId = getAssetIdByName(assetName) | |
302 | 350 | let amount = match getInteger(this, balanceKey) { | |
303 | 351 | case b: Int => | |
304 | 352 | b | |
307 | 355 | } | |
308 | 356 | if ((minWithdraw > amount)) | |
309 | 357 | then throw(("Min withdraw amount is" + toString(minWithdraw))) | |
310 | - | else ScriptResult(WriteSet([DataEntry(balanceKey, 0), DataEntry(((("withdraw_" + owner) + "_") + txid), ((toString(amount) + ":") + toString(lastBlock.timestamp)))]), TransferSet([ScriptTransfer(i.caller, | |
358 | + | else ScriptResult(WriteSet([DataEntry(balanceKey, 0), DataEntry(((("withdraw_" + owner) + "_") + txid), ((((toString(amount) + ":") + toString(lastBlock.timestamp)) + ":") + assetName))]), TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(i.caller, amount, assetId)])) | |
311 | 359 | } | |
312 | 360 | ||
313 | 361 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let betAssetIds = [DataEntry("sportr", " | |
4 | + | let betAssetIds = [DataEntry("sportr", "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"), DataEntry("dex", "WAVES")] | |
5 | 5 | ||
6 | - | let dexAgent = addressFromStringValue("3NCN79gCSaKTFV6fDoEzELoxDMrAUTCekd5") | |
6 | + | let betAssetMnemonics = [DataEntry("sportr", "USD"), DataEntry("dex", "WAVES")] | |
7 | + | ||
8 | + | let assetsDecimals = [DataEntry("USD", 2), DataEntry("WAVES", 8), DataEntry("BTC", 8), DataEntry("VST", 8)] | |
9 | + | ||
10 | + | let dexAgent = addressFromStringValue("3P69jzek6S2q7kGWScEEZaNxKL5TiSF7wGm") | |
11 | + | ||
12 | + | let changeAddress = "3PQexcLjbv9CsYbt6zKF7nfEppf2gKHCEkz" | |
7 | 13 | ||
8 | 14 | let maxFee = 5000000 | |
9 | 15 | ||
10 | - | let minBet = 5000000 | |
11 | - | ||
12 | 16 | let minCreateEvent = 30000000 | |
13 | - | ||
14 | - | let minMatchNominal = 5000000 | |
15 | 17 | ||
16 | 18 | let dexJudgeGraceTs = ((1000 * 60) * 5) | |
17 | 19 | ||
18 | 20 | let level1 = 250 | |
19 | 21 | ||
20 | 22 | let level2 = 150 | |
21 | 23 | ||
22 | 24 | let level3 = 100 | |
23 | 25 | ||
24 | 26 | let cashBack = 500 | |
25 | 27 | ||
26 | 28 | let totalRef = 10 | |
27 | 29 | ||
28 | - | let | |
30 | + | let minWithdraw = 1000000 | |
29 | 31 | ||
30 | - | let minWithdraw = 1000000 | |
32 | + | func getAssetIdByName (name) = { | |
33 | + | let assetIdByName = [DataEntry("USD", base58'Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck'), DataEntry("BTC", base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS'), DataEntry("VST", base58'4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8')] | |
34 | + | if ((name == "WAVES")) | |
35 | + | then unit | |
36 | + | else getBinaryValue(assetIdByName, name) | |
37 | + | } | |
38 | + | ||
31 | 39 | ||
32 | 40 | func getCallerByDelegate (i,function) = { | |
33 | 41 | let caller = toBase58String(i.caller.bytes) | |
34 | 42 | let callerPrefix = ("delegate_" + caller) | |
35 | 43 | if ((getBoolean(this, ((callerPrefix + "_") + function)) == true)) | |
36 | 44 | then match getString(this, (callerPrefix + "_address")) { | |
37 | 45 | case s: String => | |
38 | 46 | s | |
39 | 47 | case _ => | |
40 | 48 | caller | |
41 | 49 | } | |
42 | 50 | else caller | |
43 | 51 | } | |
44 | 52 | ||
45 | 53 | ||
46 | 54 | func checkFee (i) = if ((i.fee > maxFee)) | |
47 | 55 | then throw("unreasonable large fee") | |
48 | 56 | else if ((i.feeAssetId != unit)) | |
49 | 57 | then throw("fee must be in WAVES") | |
50 | 58 | else true | |
51 | 59 | ||
52 | 60 | ||
53 | 61 | func repayFee (i,ws,amount,recipient,betAssetId) = if (checkFee(i)) | |
54 | 62 | then if (if ((amount > 0)) | |
55 | 63 | then isDefined(recipient) | |
56 | 64 | else false) | |
57 | 65 | then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(extract(recipient), amount, betAssetId)])) | |
58 | 66 | else ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit)])) | |
59 | 67 | else throw("error") | |
60 | 68 | ||
61 | 69 | ||
62 | 70 | func checkOwner (i,betid) = (getString(this, (betid + "_owner")) == toBase58String(i.caller.bytes)) | |
63 | 71 | ||
64 | 72 | ||
65 | 73 | func getUnspent (betid) = (extract(getInteger(this, (betid + "_amount"))) - extract(getInteger(this, (betid + "_spent")))) | |
66 | 74 | ||
67 | 75 | ||
68 | 76 | func isDefeated (betid) = { | |
69 | 77 | let defeatStatus = getInteger(this, (betid + "_defeat")) | |
70 | 78 | if ((defeatStatus == 1)) | |
71 | 79 | then true | |
72 | 80 | else (defeatStatus == 3) | |
73 | 81 | } | |
74 | 82 | ||
75 | 83 | ||
76 | 84 | func getReferer (user) = getString(this, (user + "_referer")) | |
77 | 85 | ||
78 | 86 | ||
79 | - | func balanceIncrement (address,inc) = { | |
80 | - | let balanceKey = (address + "_balance") | |
87 | + | func balanceIncrement (address,asset,inc) = { | |
88 | + | let balanceKey = (((address + "_") + asset) + "_balance") | |
81 | 89 | DataEntry(balanceKey, (inc + match getInteger(this, balanceKey) { | |
82 | 90 | case b: Int => | |
83 | 91 | b | |
84 | 92 | case _ => | |
85 | 93 | 0 | |
86 | 94 | })) | |
87 | 95 | } | |
88 | 96 | ||
89 | 97 | ||
90 | - | func recordBalanceIncrement (address,owner,inc,level,txId,timestamp) = DataEntry(((("fund_" + address) + "_") + txId), | |
98 | + | func recordBalanceIncrement (address,asset,owner,inc,level,txId,timestamp) = DataEntry(((((((("fund_" + address) + "_") + asset) + "_") + level) + "_") + txId), ((((owner + ":") + toString(inc)) + ":") + timestamp)) | |
91 | 99 | ||
92 | 100 | ||
93 | 101 | func getAssetByAdapter (adapter) = { | |
94 | 102 | let assetString = getStringValue(betAssetIds, adapter) | |
95 | 103 | if ((assetString == "WAVES")) | |
96 | 104 | then unit | |
97 | 105 | else fromBase58String(assetString) | |
98 | 106 | } | |
107 | + | ||
108 | + | ||
109 | + | func getMinBetByAdapter (adapter) = getIntegerValue([DataEntry("dex", 5000000), DataEntry("sportr", 100)], adapter) | |
110 | + | ||
111 | + | ||
112 | + | func getMinMatchByAdapter (adapter) = getIntegerValue([DataEntry("dex", 1000000), DataEntry("sportr", 1)], adapter) | |
99 | 113 | ||
100 | 114 | ||
101 | 115 | func getAssetMnemonic (asset) = if ((asset == unit)) | |
102 | 116 | then "WAVES" | |
103 | 117 | else toBase58String(extract(asset)) | |
104 | 118 | ||
105 | 119 | ||
106 | 120 | @Callable(i) | |
107 | 121 | func bet (event,subevent,side,odds,adapter) = { | |
108 | 122 | let marketKey = ("market_" + event) | |
109 | 123 | let betAssetId = getAssetByAdapter(adapter) | |
124 | + | let betAssetMnemonic = getStringValue(betAssetIds, adapter) | |
110 | 125 | let owner = toBase58String(i.caller.bytes) | |
111 | 126 | let payment = extract(i.payment) | |
112 | 127 | if ((payment.assetId != betAssetId)) | |
113 | - | then throw(((("bet must be in asset " + getAssetMnemonic(betAssetId)) + " for adapter ") + adapter)) | |
114 | - | else if ((minBet > payment.amount)) | |
115 | - | then throw(("minimum allowed bet is " + toString(minBet))) | |
116 | - | else if (if (if ((adapter == "dex")) | |
117 | - | then (minCreateEvent > payment.amount) | |
118 | - | else false) | |
119 | - | then (getBoolean(this, marketKey) == unit) | |
120 | - | else false) | |
121 | - | then throw(("min amount to create first bet is " + toString(minCreateEvent))) | |
122 | - | else if (if ((side != "for")) | |
123 | - | then (side != "against") | |
128 | + | then throw(((("bet must be in asset " + betAssetMnemonic) + " for adapter ") + adapter)) | |
129 | + | else { | |
130 | + | let minBet = getMinBetByAdapter(adapter) | |
131 | + | if ((minBet > payment.amount)) | |
132 | + | then throw(("minimum allowed bet is " + toString(minBet))) | |
133 | + | else if (if (if ((adapter == "dex")) | |
134 | + | then (minCreateEvent > payment.amount) | |
124 | 135 | else false) | |
125 | - | then throw("unexpected side") | |
126 | - | else { | |
127 | - | let betid = (((((("bet_" + event) + "_") + toBase58String(i.caller.bytes)) + "_") + take(toBase58String(i.transactionId), 5)) + "_") | |
128 | - | let sequenceKey = ((("seq_" + event) + "_") + subevent) | |
129 | - | let sequence = match getInteger(this, sequenceKey) { | |
130 | - | case prevS: Int => | |
131 | - | (prevS + 1) | |
132 | - | case _ => | |
133 | - | 1 | |
134 | - | } | |
135 | - | 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 + "adapter"), adapter), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(marketKey, true), DataEntry(sequenceKey, sequence)]), 0, unit, unit) | |
136 | - | } | |
136 | + | then (getBoolean(this, marketKey) == unit) | |
137 | + | else false) | |
138 | + | then throw(("min amount to create first bet is " + toString(minCreateEvent))) | |
139 | + | else if (if ((side != "for")) | |
140 | + | then (side != "against") | |
141 | + | else false) | |
142 | + | then throw("unexpected side") | |
143 | + | else { | |
144 | + | let betid = (((((("bet_" + event) + "_") + owner) + "_") + take(toBase58String(i.transactionId), 5)) + "_") | |
145 | + | let sequenceKey = ((("seq_" + event) + "_") + subevent) | |
146 | + | let sequence = match getInteger(this, sequenceKey) { | |
147 | + | case prevS: Int => | |
148 | + | (prevS + 1) | |
149 | + | case _ => | |
150 | + | 1 | |
151 | + | } | |
152 | + | let commonRecords = [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 + "adapter"), adapter), DataEntry((betid + "timestamp"), lastBlock.timestamp), DataEntry((betid + "sequence"), sequence), DataEntry(sequenceKey, sequence)] | |
153 | + | let allRecords = if ((adapter == "dex")) | |
154 | + | then DataEntry(marketKey, true) :: commonRecords | |
155 | + | else commonRecords | |
156 | + | repayFee(i, WriteSet(allRecords), 0, unit, unit) | |
157 | + | } | |
158 | + | } | |
137 | 159 | } | |
138 | 160 | ||
139 | 161 | ||
140 | 162 | ||
141 | 163 | @Callable(i) | |
142 | 164 | func cancel (betid) = if ((getString(this, (betid + "_owner")) != getCallerByDelegate(i, "autocancel"))) | |
143 | 165 | then throw("must be owner or its delegate to cancel") | |
144 | 166 | else { | |
145 | 167 | let adapter = getStringValue(this, (betid + "_adapter")) | |
146 | 168 | let amount = getIntegerValue(this, (betid + "_amount")) | |
147 | 169 | let spent = getIntegerValue(this, (betid + "_spent")) | |
148 | 170 | let cancelAmount = (amount - spent) | |
149 | 171 | repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount, i.caller, getAssetByAdapter(adapter)) | |
150 | 172 | } | |
151 | 173 | ||
152 | 174 | ||
153 | 175 | ||
154 | 176 | @Callable(i) | |
155 | 177 | func betMatch (betFor,betAgainst) = if ((getString(this, (betFor + "_event")) != getString(this, (betAgainst + "_event")))) | |
156 | 178 | then throw("event id must match") | |
157 | 179 | else if ((getString(this, (betFor + "_subevent")) != getString(this, (betAgainst + "_subevent")))) | |
158 | 180 | then throw("subevent id must match") | |
159 | 181 | else if ((getString(this, (betFor + "_side")) != "for")) | |
160 | 182 | then throw("invalid *for* bet") | |
161 | 183 | else if ((getString(this, (betAgainst + "_side")) != "against")) | |
162 | 184 | then throw("invalid *against* bet") | |
163 | 185 | else { | |
164 | 186 | let adapter = getStringValue(this, (betFor + "_adapter")) | |
165 | 187 | if ((adapter != getStringValue(this, (betAgainst + "_adapter")))) | |
166 | 188 | then throw("bets has different adapters") | |
167 | 189 | else { | |
190 | + | let minMatchNominal = getMinMatchByAdapter(adapter) | |
168 | 191 | let betForOwner = getStringValue(this, (betFor + "_owner")) | |
169 | 192 | let betAgainstOwner = getStringValue(this, (betAgainst + "_owner")) | |
170 | 193 | let eventid = extract(getString(this, (betFor + "_event"))) | |
171 | 194 | let matchid = (((((((("match_" + eventid) + "_") + takeRight(betForOwner, 10)) + "_") + takeRight(betAgainstOwner, 10)) + "_") + takeRight(toBase58String(i.transactionId), 10)) + "_") | |
172 | 195 | let odds = extract(getInteger(this, (betFor + "_odds"))) | |
173 | 196 | let unspentFor = getUnspent(betFor) | |
174 | 197 | let unspentAgainst = getUnspent(betAgainst) | |
175 | 198 | let maxForNominal = unspentFor | |
176 | 199 | let maxAgainstNominal = ((unspentAgainst * 100) / (odds - 100)) | |
177 | 200 | let matchNominal = if ((maxForNominal > maxAgainstNominal)) | |
178 | 201 | then maxAgainstNominal | |
179 | 202 | else maxForNominal | |
180 | 203 | if ((minMatchNominal > matchNominal)) | |
181 | 204 | then throw("match nominal too low") | |
182 | 205 | else { | |
183 | 206 | let spendFor = matchNominal | |
184 | 207 | let spendAgainst = ((matchNominal * (odds - 100)) / 100) | |
185 | 208 | let newSpentFor = (spendFor + extract(getInteger(this, (betFor + "_spent")))) | |
186 | 209 | let newSpentAgainst = (spendAgainst + extract(getInteger(this, (betAgainst + "_spent")))) | |
187 | 210 | if ((newSpentFor > extract(getInteger(this, (betFor + "_amount"))))) | |
188 | 211 | then throw("invalid match") | |
189 | 212 | else if ((newSpentAgainst > extract(getInteger(this, (betAgainst + "_amount"))))) | |
190 | 213 | then throw("invalid match") | |
191 | 214 | else repayFee(i, WriteSet([DataEntry((matchid + "amount"), (spendFor + spendAgainst)), DataEntry((matchid + "adapter"), adapter), DataEntry((matchid + "for"), betFor), DataEntry((matchid + "against"), betAgainst), DataEntry((betFor + "_spent"), newSpentFor), DataEntry((betAgainst + "_spent"), newSpentAgainst)]), 0, unit, unit) | |
192 | 215 | } | |
193 | 216 | } | |
194 | 217 | } | |
195 | 218 | ||
196 | 219 | ||
197 | 220 | ||
198 | 221 | @Callable(i) | |
199 | - | func approveDefeat (betId,defeat) = if (if (isDefined(getInteger(this, (betId + "_defeat")))) | |
200 | - | then (defeat == 2) | |
201 | - | else false) | |
202 | - | then throw("can't dispute after approve") | |
203 | - | else if ((getString(this, (betId + "_owner")) != getCallerByDelegate(i, "autoapprove"))) | |
204 | - | then throw("must be owner or its delegate to approve") | |
205 | - | else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit, unit) | |
222 | + | func approveDefeat (betId,defeat) = { | |
223 | + | let a = extract(assetInfo(base58'')) | |
224 | + | if (if (isDefined(getInteger(this, (betId + "_defeat")))) | |
225 | + | then (defeat == 2) | |
226 | + | else false) | |
227 | + | then throw("can't dispute after approve") | |
228 | + | else if ((getString(this, (betId + "_owner")) != getCallerByDelegate(i, "autoapprove"))) | |
229 | + | then throw("must be owner or its delegate to approve") | |
230 | + | else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit, unit) | |
231 | + | } | |
206 | 232 | ||
207 | 233 | ||
208 | 234 | ||
209 | 235 | @Callable(i) | |
210 | 236 | func judgeDexMatch (matchId) = if ((getStringValue(this, (matchId + "_adapter")) != "dex")) | |
211 | 237 | then throw("method is only for dex matches") | |
212 | 238 | else if ((getBoolean(this, (matchId + "_judged")) == true)) | |
213 | 239 | then throw("already judged") | |
214 | 240 | else { | |
215 | 241 | let betFor = getStringValue(this, (matchId + "_for")) | |
216 | 242 | let betAgainst = getStringValue(this, (matchId + "_against")) | |
217 | 243 | let event = getStringValue(this, (betFor + "_event")) | |
218 | 244 | let eventS = split(event, ":") | |
219 | 245 | let pair = eventS[1] | |
220 | 246 | let eventRate = parseIntValue(eventS[2]) | |
221 | 247 | let eventTs = parseIntValue(eventS[3]) | |
248 | + | let pairSplit = split(pair, "/") | |
249 | + | let pairDecimals1 = getIntegerValue(assetsDecimals, pairSplit[0]) | |
250 | + | let pairDecimals2 = getIntegerValue(assetsDecimals, pairSplit[1]) | |
251 | + | let rateCorrectionPower = (pairDecimals1 - pairDecimals2) | |
252 | + | let rateCorrection = if ((rateCorrectionPower == 0)) | |
253 | + | then 1 | |
254 | + | else if ((rateCorrectionPower == 1)) | |
255 | + | then 10 | |
256 | + | else if ((rateCorrectionPower == 2)) | |
257 | + | then 100 | |
258 | + | else if ((rateCorrectionPower == 3)) | |
259 | + | then 1000 | |
260 | + | else if ((rateCorrectionPower == 4)) | |
261 | + | then 10000 | |
262 | + | else if ((rateCorrectionPower == 5)) | |
263 | + | then 100000 | |
264 | + | else if ((rateCorrectionPower == 6)) | |
265 | + | then 1000000 | |
266 | + | else if ((rateCorrectionPower == 7)) | |
267 | + | then 10000000 | |
268 | + | else if ((rateCorrectionPower == 8)) | |
269 | + | then 100000000 | |
270 | + | else throw("unsupported") | |
222 | 271 | let judgeTs = ((eventTs * 1000) + dexJudgeGraceTs) | |
223 | 272 | if ((judgeTs > lastBlock.timestamp)) | |
224 | 273 | then throw(("please wait for timestamp " + toString(judgeTs))) | |
225 | 274 | else { | |
226 | 275 | let rateFromAgent = getInteger(dexAgent, (event + "_rate")) | |
227 | 276 | if (!(isDefined(rateFromAgent))) | |
228 | 277 | then throw("rate from agent not ready yet") | |
229 | 278 | else { | |
230 | - | let looserBet = if ((extract(rateFromAgent) > | |
279 | + | let looserBet = if (((extract(rateFromAgent) * rateCorrection) > eventRate)) | |
231 | 280 | then betAgainst | |
232 | 281 | else betFor | |
233 | 282 | repayFee(i, WriteSet([DataEntry((looserBet + "_defeat"), 1), DataEntry((matchId + "_judged"), true)]), 0, unit, unit) | |
234 | 283 | } | |
235 | 284 | } | |
236 | 285 | } | |
237 | 286 | ||
238 | 287 | ||
239 | 288 | ||
240 | 289 | @Callable(i) | |
241 | 290 | func payWinner (matchId) = if (!(checkFee(i))) | |
242 | 291 | then throw("error") | |
243 | - | else if (isDefined( | |
292 | + | else if (isDefined(getString(this, (matchId + "_paid")))) | |
244 | 293 | then throw("already paid") | |
245 | 294 | else { | |
246 | 295 | let adapter = getStringValue(this, (matchId + "_adapter")) | |
247 | 296 | let betAssetId = getAssetByAdapter(adapter) | |
297 | + | let betAssetMnemonic = getStringValue(betAssetMnemonics, adapter) | |
248 | 298 | let betForId = extract(getString(this, (matchId + "_for"))) | |
249 | 299 | let betAgainstId = extract(getString(this, (matchId + "_against"))) | |
250 | 300 | let betForDefeated = isDefeated(betForId) | |
251 | 301 | let betAgainstDefeated = isDefeated(betAgainstId) | |
252 | 302 | if (if (!(betForDefeated)) | |
253 | 303 | then !(betAgainstDefeated) | |
254 | 304 | else false) | |
255 | 305 | then throw("no side approved defeat") | |
256 | 306 | else { | |
257 | 307 | let winnerId = if (betForDefeated) | |
258 | 308 | then betAgainstId | |
259 | 309 | else betForId | |
260 | 310 | let winnerAddress = getStringValue(this, (winnerId + "_owner")) | |
261 | 311 | let amount = extract(getInteger(this, (matchId + "_amount"))) | |
262 | 312 | let txid = toBase58String(i.transactionId) | |
263 | 313 | let timestamp = toString(lastBlock.timestamp) | |
264 | 314 | let refAmount = ((amount * totalRef) / 1000) | |
265 | 315 | ScriptResult(WriteSet([DataEntry((matchId + "_paid"), toBase58String(i.transactionId)), match getReferer(winnerAddress) { | |
266 | 316 | case ref1: String => | |
267 | 317 | let incLevel1 = ((refAmount * level1) / 1000) | |
268 | 318 | let incCashBack = ((refAmount * cashBack) / 1000) | |
269 | - | [balanceIncrement(winnerAddress, incCashBack), recordBalanceIncrement(winnerAddress, winnerAddress, incCashBack, "cashback", txid, timestamp), balanceIncrement(ref1, incLevel1), recordBalanceIncrement(ref1, winnerAddress, incLevel1, "l1", txid, timestamp), match getReferer(ref1) { | |
319 | + | [balanceIncrement(winnerAddress, betAssetMnemonic, incCashBack), recordBalanceIncrement(winnerAddress, betAssetMnemonic, winnerAddress, incCashBack, "cashback", txid, timestamp), balanceIncrement(ref1, betAssetMnemonic, incLevel1), recordBalanceIncrement(ref1, betAssetMnemonic, winnerAddress, incLevel1, "l1", txid, timestamp), match getReferer(ref1) { | |
270 | 320 | case ref2: String => | |
271 | 321 | let incLevel2 = ((refAmount * level2) / 1000) | |
272 | - | [balanceIncrement(ref2, incLevel2), recordBalanceIncrement(ref2, winnerAddress, incLevel2, "l2", txid, timestamp), match getReferer(ref2) { | |
273 | - | case ref3: String => | |
274 | - | let incLevel3 = ((refAmount * level3) / 1000) | |
275 | - | [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)] | |
322 | + | [balanceIncrement(ref2, betAssetMnemonic, incLevel2), recordBalanceIncrement(ref2, betAssetMnemonic, winnerAddress, incLevel2, "l2", txid, timestamp), match getReferer(ref2) { | |
276 | 323 | case _ => | |
277 | - | [balanceIncrement(changeAddress, ((refAmount - incLevel1) - incLevel2)), recordBalanceIncrement(changeAddress, winnerAddress, ((refAmount - incLevel1) - incLevel2), "change", txid, timestamp)] | |
324 | + | [balanceIncrement(changeAddress, betAssetMnemonic, ((refAmount - incLevel1) - incLevel2)), recordBalanceIncrement(changeAddress, betAssetMnemonic, winnerAddress, ((refAmount - incLevel1) - incLevel2), "change", txid, timestamp)] | |
278 | 325 | }] | |
279 | 326 | case _ => | |
280 | - | [balanceIncrement(changeAddress, (refAmount - incLevel1)), recordBalanceIncrement(changeAddress, winnerAddress, (refAmount - incLevel1), "change", txid, timestamp)] | |
327 | + | [balanceIncrement(changeAddress, betAssetMnemonic, (refAmount - incLevel1)), recordBalanceIncrement(changeAddress, betAssetMnemonic, winnerAddress, (refAmount - incLevel1), "change", txid, timestamp)] | |
281 | 328 | }] | |
282 | 329 | case _ => | |
283 | - | [balanceIncrement(changeAddress, refAmount), recordBalanceIncrement(changeAddress, winnerAddress, refAmount, "change", txid, timestamp)] | |
330 | + | [balanceIncrement(changeAddress, betAssetMnemonic, refAmount), recordBalanceIncrement(changeAddress, betAssetMnemonic, winnerAddress, refAmount, "change", txid, timestamp)] | |
284 | 331 | }]), TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(addressFromStringValue(winnerAddress), (amount - refAmount), betAssetId)])) | |
285 | 332 | } | |
286 | 333 | } | |
287 | 334 | ||
288 | 335 | ||
289 | 336 | ||
290 | 337 | @Callable(i) | |
291 | 338 | 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, unit) | |
292 | 339 | ||
293 | 340 | ||
294 | 341 | ||
295 | 342 | @Callable(i) | |
296 | - | func withdraw () = if (!(checkFee(i))) | |
343 | + | func withdraw (assetName) = if (!(checkFee(i))) | |
297 | 344 | then throw("error") | |
298 | 345 | else { | |
299 | 346 | let owner = toBase58String(i.caller.bytes) | |
300 | 347 | let txid = toBase58String(i.transactionId) | |
301 | - | let balanceKey = (owner + "_balance") | |
348 | + | let balanceKey = (((owner + "_") + assetName) + "_balance") | |
349 | + | let assetId = getAssetIdByName(assetName) | |
302 | 350 | let amount = match getInteger(this, balanceKey) { | |
303 | 351 | case b: Int => | |
304 | 352 | b | |
305 | 353 | case _ => | |
306 | 354 | 0 | |
307 | 355 | } | |
308 | 356 | if ((minWithdraw > amount)) | |
309 | 357 | then throw(("Min withdraw amount is" + toString(minWithdraw))) | |
310 | - | else ScriptResult(WriteSet([DataEntry(balanceKey, 0), DataEntry(((("withdraw_" + owner) + "_") + txid), ((toString(amount) + ":") + toString(lastBlock.timestamp)))]), TransferSet([ScriptTransfer(i.caller, | |
358 | + | else ScriptResult(WriteSet([DataEntry(balanceKey, 0), DataEntry(((("withdraw_" + owner) + "_") + txid), ((((toString(amount) + ":") + toString(lastBlock.timestamp)) + ":") + assetName))]), TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(i.caller, amount, assetId)])) | |
311 | 359 | } | |
312 | 360 | ||
313 | 361 | ||
314 | 362 | ||
315 | 363 | @Callable(i) | |
316 | 364 | func register (referer,salt) = if (!(checkFee(i))) | |
317 | 365 | then throw("error") | |
318 | 366 | else if ((take(toBase58String(i.transactionId), 3) != "123")) | |
319 | 367 | then throw("proof of work failed") | |
320 | 368 | else { | |
321 | 369 | let owner = toBase58String(i.caller.bytes) | |
322 | 370 | if (isDefined(getReferer(owner))) | |
323 | 371 | then throw("Already registered") | |
324 | 372 | else ScriptResult(WriteSet([DataEntry((owner + "_referer"), referer), DataEntry(((referer + "_referral_") + owner), owner)]), TransferSet([ScriptTransfer(i.caller, i.fee, unit)])) | |
325 | 373 | } | |
326 | 374 | ||
327 | 375 |
github/deemru/w8io/026f985 58.37 ms ◑