tx · 9XGUyGjAisU4jPp1xofxtNXaetM4zAexSznFSrKyg43Q

3MxT9KhqtLvQNSdpopeicVP5G2pdeteVUAS:  -0.01000000 Waves

2019.07.17 22:58 [590295] smart account 3MxT9KhqtLvQNSdpopeicVP5G2pdeteVUAS > SELF 0.00000000 Waves

{ "type": 13, "id": "9XGUyGjAisU4jPp1xofxtNXaetM4zAexSznFSrKyg43Q", "fee": 1000000, "feeAssetId": null, "timestamp": 1563393548143, "version": 1, "sender": "3MxT9KhqtLvQNSdpopeicVP5G2pdeteVUAS", "senderPublicKey": "DqTbGp44SdYL9KBGBCX24fHBspoBqGnWkKcajty6etG6", "proofs": [ "ZN3yFC17MoKbv54uC71MnfV8Kv3wv6D1SMWCcq2jj3DMB4zHouuPpW1LviZ3WVHnjqbdSu2V6QjCUmCGSkEj78Z" ], "script": "base64:AAIDAAAAAAAAAAAAAAAHAAAAAAl3YXZlc0xldHMAAAAAAAX14QAAAAAADlRvdGFsQW1vdW50S2V5AgAAAAtUb3RhbEFtb3VudAAAAAASVG90YWxBbW91bnRMZWZ0S2V5AgAAAA9Ub3RhbEFtb3VudExlZnQAAAAACHJlY2VpdmVyAgAAACMzTXZ2dzlxajdSVWZ0cmRKa0RkaUFvQ1Fnb0JBVndrUkczeAAAAAAOTGFzdFBheW1lbnRLZXkCAAAAC0xhc3RQYXltZW50AAAAAA5QYXltZW50VGltZW91dAAAAAAAAAAACgAAAAAJTWF4U2FsYXJ5AAAAAAAAAAABAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIWNhbiBob2RsIHdhdmVzIG9ubHkgYXQgdGhlIG1vbWVudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA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AAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASVG90YWxBbW91bnRMZWZ0S2V5BQAAAA1uZXdBbW91bnRMZWZ0CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA5MYXN0UGF5bWVudEtleQUAAAAGaGVpZ2h0BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAhyZWNlaXZlcgUAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAB1LbSvg=", "chainId": 84, "height": 590295, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let wavesLets = 100000000
5+
6+let TotalAmountKey = "TotalAmount"
7+
8+let TotalAmountLeftKey = "TotalAmountLeft"
9+
10+let receiver = "3Mvvw9qj7RUftrdJkDdiAoCQgoBAVwkRG3x"
11+
12+let LastPaymentKey = "LastPayment"
13+
14+let PaymentTimeout = 10
15+
16+let MaxSalary = 1
17+
18+@Callable(i)
19+func deposit () = {
20+ let pmt = extract(i.payment)
21+ if (isDefined(pmt.assetId))
22+ then throw("can hodl waves only at the moment")
23+ else {
24+ let currentKey = toBase58String(i.caller.bytes)
25+ let currentAmount = match getInteger(this, currentKey) {
26+ case a: Int =>
27+ a
28+ case _ =>
29+ 0
30+ }
31+ let currentTotalAmount = match getInteger(this, TotalAmountKey) {
32+ case a: Int =>
33+ a
34+ case _ =>
35+ 0
36+ }
37+ let currentAmountLeft = match getInteger(this, TotalAmountLeftKey) {
38+ case a: Int =>
39+ a
40+ case _ =>
41+ 0
42+ }
43+ let newAmount = (currentAmount + pmt.amount)
44+ let newtotalAmount = (currentTotalAmount + pmt.amount)
45+ let newtotalamountleft = (currentAmountLeft + pmt.amount)
46+ WriteSet([DataEntry(currentKey, newAmount), DataEntry(TotalAmountKey, newtotalAmount), DataEntry(TotalAmountLeftKey, newtotalamountleft)])
47+ }
48+ }
49+
50+
51+
52+@Callable(i)
53+func withdraw (amount) = {
54+ let currentKey = toBase58String(i.caller.bytes)
55+ let currentAmountLeft = match getInteger(this, TotalAmountLeftKey) {
56+ case a: Int =>
57+ a
58+ case _ =>
59+ 0
60+ }
61+ let lastPayment = match getInteger(this, LastPaymentKey) {
62+ case a: Int =>
63+ a
64+ case _ =>
65+ 0
66+ }
67+ if (((lastPayment + PaymentTimeout) > height))
68+ then throw("Next payment not yet allowed")
69+ else {
70+ let newAmountLeft = (currentAmountLeft - amount)
71+ if ((0 > amount))
72+ then throw("Can't withdraw negative amount")
73+ else if ((amount > (MaxSalary * wavesLets)))
74+ then throw((("Not allowed to withdraw more than " + toString(MaxSalary)) + " WAVES"))
75+ else if ((0 > newAmountLeft))
76+ then throw("Not enough balance")
77+ else ScriptResult(WriteSet([DataEntry(TotalAmountLeftKey, newAmountLeft), DataEntry(LastPaymentKey, height)]), TransferSet([ScriptTransfer(addressFromStringValue(receiver), amount, unit)]))
78+ }
79+ }
80+
81+
82+@Verifier(tx)
83+func verify () = false
84+

github/deemru/w8io/169f3d6 
31.52 ms