tx · 8sYkvvSxsG9om5qmJCi2mWHry7WsVtYdd34WuF7bX1bB

3MsJqZkQ8i6WTqbwK5uUckkd2p9AuuSb6D7:  -0.04000000 Waves

2019.07.25 13:27 [601449] smart account 3MsJqZkQ8i6WTqbwK5uUckkd2p9AuuSb6D7 > SELF 0.00000000 Waves

{ "type": 13, "id": "8sYkvvSxsG9om5qmJCi2mWHry7WsVtYdd34WuF7bX1bB", "fee": 4000000, "feeAssetId": null, "timestamp": 1564050497362, "version": 1, "sender": "3MsJqZkQ8i6WTqbwK5uUckkd2p9AuuSb6D7", "senderPublicKey": "FX5kBZexFDRcKjzvJd5nFmpUHHzs7JcH2kTjiA7viDUZ", "proofs": [ "66j83TjEYyrvmqHGtJ8nX6LgBX6WRDGqpY4bWG3fn4sp2TL3HGKDMbtZERVjh3htsBx9PmRR9a6HkYkP4FEJdvhs" ], "script": null, "chainId": 84, "height": 601449, "spentComplexity": 0 } View: original | compacted Prev: HeFJLwbPVU1vXAsmcGjYJBhUJ7Xmak5kg17ZoKGAj8Ax Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 3 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-
5-
6-@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 newAmount = (currentAmount + pmt.amount)
20- WriteSet([DataEntry(currentKey, newAmount)])
21- }
22- }
23-
24-
25-
26-@Callable(i)
27-func withdraw (amount) = {
28- let currentKey = toBase58String(i.caller.bytes)
29- let currentAmount = match getInteger(this, currentKey) {
30- case a: Int =>
31- a
32- case _ =>
33- 0
34- }
35- let newAmount = (currentAmount - amount)
36- if ((0 > amount))
37- then throw("Can't withdraw negative amount")
38- else if ((0 > newAmount))
39- then throw("Not enough balance")
40- else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
41- }
42-
43-
1+# no script

github/deemru/w8io/026f985 
18.44 ms