tx · G5L8Kb1i7gpS6hJrnM5hWoKvVRGBhPpRvz2MymgsTa9z

3N9gCgZp6acUQSRjKT1Dj2YxrKVjKREaVr2:  -0.01000000 Waves

2019.07.17 23:37 [590335] smart account 3N9gCgZp6acUQSRjKT1Dj2YxrKVjKREaVr2 > SELF 0.00000000 Waves

{ "type": 13, "id": "G5L8Kb1i7gpS6hJrnM5hWoKvVRGBhPpRvz2MymgsTa9z", "fee": 1000000, "feeAssetId": null, "timestamp": 1563395871040, "version": 1, "sender": "3N9gCgZp6acUQSRjKT1Dj2YxrKVjKREaVr2", "senderPublicKey": "5pHdyrSDWgZu1GZkTJdDtdYgZzbVv1aKqdnzU85EuZXy", "proofs": [ "5A5h7ZufqpvsQf2MDT8fsv8AnKrycW6oM9dQYYD7HfkTAy4BS6jY1XNatHBGyJPr7Gkbwsc5asXDzod6zsfub2EU" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAAl3YXZlc0xldHMAAAAAAAX14QAAAAAADlRvdGFsQW1vdW50S2V5AgAAAAtUb3RhbEFtb3VudAAAAAASVG90YWxBbW91bnRMZWZ0S2V5AgAAAA9Ub3RhbEFtb3VudExlZnQAAAAADnJlY2VpdmVyUHViS2V5AQAAACB2Lt2XPxnJEMOf3j2+gaj34kBaBNp9mp+RlGZfgwFlLgAAAAAIcmVjZWl2ZXIJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAADnJlY2VpdmVyUHViS2V5AAAAAA5MYXN0UGF5bWVudEtleQIAAAALTGFzdFBheW1lbnQAAAAADlBheW1lbnRUaW1lb3V0AAAAAAAAAAAKAAAAAAlNYXhTYWxhcnkAAAAAAAAAAAEAAAACAAAAAWkBAAAAB2RlcG9zaXQAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAhY2FuIGhvZG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U2FsYXJ5BQAAAAl3YXZlc0xldHMJAAACAAAAAQkAASwAAAACCQABLAAAAAICAAAAIk5vdCBhbGxvd2VkIHRvIHdpdGhkcmF3IG1vcmUgdGhhbiAJAAGkAAAAAQUAAAAJTWF4U2FsYXJ5AgAAAAYgV0FWRVMDCQAAZgAAAAIAAAAAAAAAAAAFAAAADW5ld0Ftb3VudExlZnQJAAACAAAAAQIAAAASTm90IGVub3VnaCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASVG90YWxBbW91bnRMZWZ0S2V5BQAAAA1uZXdBbW91bnRMZWZ0CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAA5MYXN0UGF5bWVudEtleQUAAAAGaGVpZ2h0BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAIcmVjZWl2ZXIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFzBQAAAAckbWF0Y2gwBgcW8I25", "chainId": 84, "height": 590335, "spentComplexity": 0 } View: original | compacted Prev: none Next: F3HGUnsaU9SYovRExpA8DGLmgo1LYHwhfna98sWwvoVb 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 receiverPubKey = base58'8xLZH4uWaXHqxNcaf48a41X1bnYhPmkYs4kKcSBHp3xR'
11+
12+let receiver = addressFromPublicKey(receiverPubKey)
13+
14+let LastPaymentKey = "LastPayment"
15+
16+let PaymentTimeout = 10
17+
18+let MaxSalary = 1
19+
20+@Callable(i)
21+func deposit () = {
22+ let pmt = extract(i.payment)
23+ if (isDefined(pmt.assetId))
24+ then throw("can hodl waves only at the moment")
25+ else {
26+ let currentKey = toBase58String(i.caller.bytes)
27+ let currentAmount = match getInteger(this, currentKey) {
28+ case a: Int =>
29+ a
30+ case _ =>
31+ 0
32+ }
33+ let currentTotalAmount = match getInteger(this, TotalAmountKey) {
34+ case a: Int =>
35+ a
36+ case _ =>
37+ 0
38+ }
39+ let currentAmountLeft = match getInteger(this, TotalAmountLeftKey) {
40+ case a: Int =>
41+ a
42+ case _ =>
43+ 0
44+ }
45+ let newAmount = (currentAmount + pmt.amount)
46+ let newtotalAmount = (currentTotalAmount + pmt.amount)
47+ let newtotalamountleft = (currentAmountLeft + pmt.amount)
48+ WriteSet([DataEntry(currentKey, newAmount), DataEntry(TotalAmountKey, newtotalAmount), DataEntry(TotalAmountLeftKey, newtotalamountleft)])
49+ }
50+ }
51+
52+
53+
54+@Callable(i)
55+func withdraw (amount) = {
56+ let currentKey = toBase58String(i.caller.bytes)
57+ let AllowedSigner = (i.caller == receiver)
58+ let currentAmountLeft = match getInteger(this, TotalAmountLeftKey) {
59+ case a: Int =>
60+ a
61+ case _ =>
62+ 0
63+ }
64+ let lastPayment = match getInteger(this, LastPaymentKey) {
65+ case a: Int =>
66+ a
67+ case _ =>
68+ 0
69+ }
70+ if (!(AllowedSigner))
71+ then throw("Withdraw is only allowed by recipient")
72+ else if (((lastPayment + PaymentTimeout) > height))
73+ then throw("Next payment not yet allowed")
74+ else {
75+ let newAmountLeft = (currentAmountLeft - amount)
76+ if ((0 > amount))
77+ then throw("Can't withdraw negative amount")
78+ else if ((amount > (MaxSalary * wavesLets)))
79+ then throw((("Not allowed to withdraw more than " + toString(MaxSalary)) + " WAVES"))
80+ else if ((0 > newAmountLeft))
81+ then throw("Not enough balance")
82+ else ScriptResult(WriteSet([DataEntry(TotalAmountLeftKey, newAmountLeft), DataEntry(LastPaymentKey, height)]), TransferSet([ScriptTransfer(receiver, amount, unit)]))
83+ }
84+ }
85+
86+
87+@Verifier(tx)
88+func verify () = match tx {
89+ case s: SetScriptTransaction =>
90+ true
91+ case _ =>
92+ false
93+}
94+

github/deemru/w8io/169f3d6 
35.56 ms