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/XAXMBPEnDQ5kqHUHyOfWmXu9KHDHL6zcNNwAAAAAGbWF4RmVlAAAAAAAATEtAAAAAAAZtaW5CZXQAAAAAAABMS0AAAAAAD21pbk1hdGNoTm9taW5hbAAAAAAAAExLQAAAAAAGbGV2ZWwxAAAAAAAAAAADAAAAAAZsZXZlbDIAAAAAAAAAAAEAAAAABmxldmVsMwAAAAAAAAAAAQAAAAAIY2FzaEJhY2sAAAAAAAAAAAUAAAAADWNoYW5nZUFkZHJlc3MCAAAAIzNOQXhzYkh4UzYzYXpkQWljVnZMR3N4akFROURzSzZMNE5MAAAAAAttaW5XaXRoZHJhdwAAAAAAAA9CQAEAAAATZ2V0Q2FsbGVyQnlEZWxlZ2F0ZQAAAAIAAAABaQAAAAhmdW5jdGlvbgQAAAAGY2FsbGVyCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADGNhbGxlclByZWZpeAkAASwAAAACAgAAAAlkZWxlZ2F0ZV8FAAAABmNhbGxlcgMJAAAAAAAAAg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gAAAAIAAAAHcmVmZXJlcgAAAARzYWx0AwkBAAAAASEAAAABCQEAAAAIY2hlY2tGZWUAAAABBQAAAAFpCQAAAgAAAAECAAAABWVycm9yAwkBAAAAAiE9AAAAAgkAAS8AAAACCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQAAAAAAAAAAAMCAAAAAzEyMwkAAAIAAAABAgAAABRwcm9vZiBvZiB3b3JrIGZhaWxlZAQAAAAFb3duZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAQAAAAlpc0RlZmluZWQAAAABCQEAAAAKZ2V0UmVmZXJlcgAAAAEFAAAABW93bmVyCQAAAgAAAAECAAAAEkFscmVhZHkgcmVnaXN0ZXJlZAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAFb3duZXICAAAACF9yZWZlcmVyBQAAAAdyZWZlcmVyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAHcmVmZXJlcgIAAAAKX3JlZmVycmFsXwUAAAAFb3duZXIFAAAABW93bmVyBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyCAUAAAABaQAAAANmZWUFAAAABHVuaXQFAAAAA25pbAAAAADr/zv5", "chainId": 84, "height": 643928, "spentComplexity": 0 } View: original | compacted Prev: HrRyXSmCQ1HmXUqYFCv7oF2P4iMarSBGPptzuQhSaeCv Next: DLxWEvxiwsUidWEArdj6diuL3GM88UxGnfEoHdM4jDsh Diff:
OldNewDifferences
88 let minBet = 5000000
99
1010 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
1123
1224 func getCallerByDelegate (i,function) = {
1325 let caller = toBase58String(i.caller.bytes)
5163 then true
5264 else (defeatStatus == 3)
5365 }
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))
5483
5584
5685 @Callable(i)
143172
144173
145174 @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+ }
166218
167219
168220
170222 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)
171223
172224
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+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let betAssetId = base58'33kV5hRVtgEGpYqhp9wQn2g9hP1fNWSYGCzzYk1T9Hyg'
55
66 let maxFee = 5000000
77
88 let minBet = 5000000
99
1010 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
1123
1224 func getCallerByDelegate (i,function) = {
1325 let caller = toBase58String(i.caller.bytes)
1426 let callerPrefix = ("delegate_" + caller)
1527 if ((getBoolean(this, ((callerPrefix + "_") + function)) == true))
1628 then match getString(this, (callerPrefix + "_address")) {
1729 case s: String =>
1830 s
1931 case _ =>
2032 caller
2133 }
2234 else caller
2335 }
2436
2537
2638 func checkFee (i) = if ((i.fee > maxFee))
2739 then throw("unreasonable large fee")
2840 else if ((i.feeAssetId != unit))
2941 then throw("fee must be in WAVES")
3042 else true
3143
3244
3345 func repayFee (i,ws,amount,recipient) = if (checkFee(i))
3446 then if (if ((amount > 0))
3547 then isDefined(recipient)
3648 else false)
3749 then ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit), ScriptTransfer(extract(recipient), amount, betAssetId)]))
3850 else ScriptResult(ws, TransferSet([ScriptTransfer(i.caller, i.fee, unit)]))
3951 else throw("error")
4052
4153
4254 func checkOwner (i,betid) = (getString(this, (betid + "_owner")) == toBase58String(i.caller.bytes))
4355
4456
4557 func getUnspent (betid) = (extract(getInteger(this, (betid + "_amount"))) - extract(getInteger(this, (betid + "_spent"))))
4658
4759
4860 func isDefeated (betid) = {
4961 let defeatStatus = getInteger(this, (betid + "_defeat"))
5062 if ((defeatStatus == 1))
5163 then true
5264 else (defeatStatus == 3)
5365 }
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))
5483
5584
5685 @Callable(i)
5786 func bet (event,subevent,side,odds) = {
5887 let owner = toBase58String(i.caller.bytes)
5988 let payment = extract(i.payment)
6089 if ((payment.assetId != betAssetId))
6190 then throw(("bet must be in asset " + toBase58String(betAssetId)))
6291 else if ((minBet > payment.amount))
6392 then throw(("minimum allowed bet is " + toString(minBet)))
6493 else if (if ((side != "for"))
6594 then (side != "against")
6695 else false)
6796 then throw("unexpected side")
6897 else {
6998 let betid = (((((("bet_" + event) + "_") + toBase58String(i.caller.bytes)) + "_") + take(toBase58String(i.transactionId), 15)) + "_")
7099 let sequenceKey = ((("seq_" + event) + "_") + subevent)
71100 let sequence = match getInteger(this, sequenceKey) {
72101 case prevS: Int =>
73102 (prevS + 1)
74103 case _ =>
75104 1
76105 }
77106 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)
78107 }
79108 }
80109
81110
82111
83112 @Callable(i)
84113 func cancel (betid) = if ((getString(this, (betid + "_owner")) != getCallerByDelegate(i, "autocancel")))
85114 then throw("must be owner or its delegate to cancel")
86115 else {
87116 let amount = extract(getInteger(this, (betid + "_amount")))
88117 let spent = extract(getInteger(this, (betid + "_spent")))
89118 let cancelAmount = (amount - spent)
90119 repayFee(i, WriteSet([DataEntry((betid + "_spent"), amount), DataEntry((betid + "_cancel_amount"), cancelAmount), DataEntry((betid + "_cancel_tx"), toBase58String(i.transactionId))]), cancelAmount, i.caller)
91120 }
92121
93122
94123
95124 @Callable(i)
96125 func betMatch (betFor,betAgainst) = if ((getString(this, (betFor + "_event")) != getString(this, (betAgainst + "_event"))))
97126 then throw("event id must match")
98127 else if ((getString(this, (betFor + "_subevent")) != getString(this, (betAgainst + "_subevent"))))
99128 then throw("subevent id must match")
100129 else if ((getString(this, (betFor + "_side")) != "for"))
101130 then throw("invalid *for* bet")
102131 else if ((getString(this, (betAgainst + "_side")) != "against"))
103132 then throw("invalid *against* bet")
104133 else {
105134 let betForOwner = getStringValue(this, (betFor + "_owner"))
106135 let betAgainstOwner = getStringValue(this, (betAgainst + "_owner"))
107136 let eventid = extract(getString(this, (betFor + "_event")))
108137 let matchid = (((((((("match_" + eventid) + "_") + takeRight(betForOwner, 10)) + "_") + takeRight(betAgainstOwner, 10)) + "_") + toBase58String(i.transactionId)) + "_")
109138 let odds = extract(getInteger(this, (betFor + "_odds")))
110139 let unspentFor = getUnspent(betFor)
111140 let unspentAgainst = getUnspent(betAgainst)
112141 let maxForNominal = unspentFor
113142 let maxAgainstNominal = ((unspentAgainst * 100) / (odds - 100))
114143 let matchNominal = if ((maxForNominal > maxAgainstNominal))
115144 then maxAgainstNominal
116145 else maxForNominal
117146 if ((minMatchNominal > matchNominal))
118147 then throw("match nominal too low")
119148 else {
120149 let spendFor = matchNominal
121150 let spendAgainst = ((matchNominal * (odds - 100)) / 100)
122151 let newSpentFor = (spendFor + extract(getInteger(this, (betFor + "_spent"))))
123152 let newSpentAgainst = (spendAgainst + extract(getInteger(this, (betAgainst + "_spent"))))
124153 if ((newSpentFor > extract(getInteger(this, (betFor + "_amount")))))
125154 then throw("invalid match")
126155 else if ((newSpentAgainst > extract(getInteger(this, (betAgainst + "_amount")))))
127156 then throw("invalid match")
128157 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)
129158 }
130159 }
131160
132161
133162
134163 @Callable(i)
135164 func approveDefeat (betId,defeat) = if (if (isDefined(getInteger(this, (betId + "_defeat"))))
136165 then (defeat == 2)
137166 else false)
138167 then throw("can't dispute after approve")
139168 else if ((getString(this, (betId + "_owner")) != getCallerByDelegate(i, "autoapprove")))
140169 then throw("must be owner or its delegate to approve")
141170 else repayFee(i, WriteSet([DataEntry((betId + "_defeat"), defeat)]), 0, unit)
142171
143172
144173
145174 @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+ }
166218
167219
168220
169221 @Callable(i)
170222 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)
171223
172224
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