tx · 7KuWq9VQg14sNK8C2QaxfVpEUpPih8tEMdWZT7wH39dh

3Mrao8xeMpyYSki9okAYbTtQwhv49AoRgWy:  -0.05000000 Waves

2020.02.06 16:45 [887428] smart account 3Mrao8xeMpyYSki9okAYbTtQwhv49AoRgWy > SELF 0.00000000 Waves

{ "type": 13, "id": "7KuWq9VQg14sNK8C2QaxfVpEUpPih8tEMdWZT7wH39dh", "fee": 5000000, "feeAssetId": null, "timestamp": 1580996766129, "version": 1, "sender": "3Mrao8xeMpyYSki9okAYbTtQwhv49AoRgWy", "senderPublicKey": "J3ZzoSpgb5TARsmT5Wv2pE3C3MHRRyXiuu55T2B6NXEY", "proofs": [ "4smeVNeRy2s6awqBCFDPeqJyuYGCSb3eumwXuxSjk6Lx9q1KQmiU4y1DaXDctcQ5sozyrtJJC82wqWr7BZqp5BvJ" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEBAAAAAAAAAAEAAAABaQEAAAAId2l0aGRyYXcAAAABAAAABmFtb3VudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgIAAAAHQkFMQU5DRQUAAAAKY3VycmVudEtleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAAluZXdBbW91bnQJAABlAAAAAgUAAAANY3VycmVudEFtb3VudAUAAAAGYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAZhbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50AwkAAGYAAAACAAAAAAAAAAAABQAAAAluZXdBbW91bnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAAdCQUxBTkNFBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAJH+Jbk=", "chainId": 84, "height": 887428, "spentComplexity": 0 } View: original | compacted Prev: EdizX4LRpazmA5LLfDiMCDvZ6EP5Yc1rn86kkDswxjMs Next: none Diff:
OldNewDifferences
44
55
66 @Callable(i)
7-func deposit () = {
8- let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("can hodl waves only at the moment")
11- else {
12- let currentKey = toBase58String(i.caller.bytes)
13- let currentAmount = match getInteger(this, currentKey) {
14- case a: Int =>
15- a
16- case _ =>
17- 0
18- }
19- let wlStsCurr = match getString(this, ("wl_sts_" + currentKey)) {
20- case a: String =>
21- a
22- case _ =>
23- throw("User has not been waitlisted")
24- }
25- let newAmount = (currentAmount + pmt.amount)
26- WriteSet([DataEntry(("BALANCE" + currentKey), newAmount)])
27- }
7+func withdraw (amount) = {
8+ let currentKey = toBase58String(i.caller.bytes)
9+ let currentAmount = match getInteger(this, ("BALANCE" + currentKey)) {
10+ case a: Int =>
11+ a
12+ case _ =>
13+ 0
14+ }
15+ let newAmount = (currentAmount - amount)
16+ if ((0 > amount))
17+ then throw("Can't withdraw negative amount")
18+ else if ((0 > newAmount))
19+ then throw("Not enough balance")
20+ else ScriptResult(WriteSet([DataEntry(("BALANCE" + currentKey), newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
2821 }
2922
3023
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
7-func deposit () = {
8- let pmt = extract(i.payment)
9- if (isDefined(pmt.assetId))
10- then throw("can hodl waves only at the moment")
11- else {
12- let currentKey = toBase58String(i.caller.bytes)
13- let currentAmount = match getInteger(this, currentKey) {
14- case a: Int =>
15- a
16- case _ =>
17- 0
18- }
19- let wlStsCurr = match getString(this, ("wl_sts_" + currentKey)) {
20- case a: String =>
21- a
22- case _ =>
23- throw("User has not been waitlisted")
24- }
25- let newAmount = (currentAmount + pmt.amount)
26- WriteSet([DataEntry(("BALANCE" + currentKey), newAmount)])
27- }
7+func withdraw (amount) = {
8+ let currentKey = toBase58String(i.caller.bytes)
9+ let currentAmount = match getInteger(this, ("BALANCE" + currentKey)) {
10+ case a: Int =>
11+ a
12+ case _ =>
13+ 0
14+ }
15+ let newAmount = (currentAmount - amount)
16+ if ((0 > amount))
17+ then throw("Can't withdraw negative amount")
18+ else if ((0 > newAmount))
19+ then throw("Not enough balance")
20+ else ScriptResult(WriteSet([DataEntry(("BALANCE" + currentKey), newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
2821 }
2922
3023

github/deemru/w8io/026f985 
31.60 ms