tx · 6LXguuSvnAfubUNFFWoxAc55QXzaPM8S6S1YPo4krp86 3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww: -0.01400000 Waves 2020.10.06 15:39 [1208712] smart account 3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww > SELF 0.00000000 Waves
{ "type": 13, "id": "6LXguuSvnAfubUNFFWoxAc55QXzaPM8S6S1YPo4krp86", "fee": 1400000, "feeAssetId": null, "timestamp": 1601988011857, "version": 2, "chainId": 84, "sender": "3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww", "senderPublicKey": "CNQtsB6HAGUVvb5L3NshmGW2pD94ysV6dzV6Zcf6BFCq", "proofs": [ "2xihndPNQ4UmMYp562tEabUqLF2ZniQsyGqNUvYc2uNzpwiNbDQUyqiN8CChWKhH43uM2c6eT9i4RKhX4AjXNcz3" ], "script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAAAAAAEAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50BAAAAANsYmgIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACFjYW4gaG9kbCB3YXZlcyBvbmx5IGF0IHRoZSBtb21lbnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAGkAAAAAQUAAAANY3VycmVudEFtb3VudAIAAAABLAkAAaQAAAABCAUAAAADcG10AAAABmFtb3VudAIAAAABLAkAAaQAAAABCQAAaAAAAAIJAABpAAAAAggFAAAAA3BtdAAAAAZhbW91bnQAAAAAAAAAAGQAAAAAAAAAAHgCAAAAASwJAAGkAAAAAQkAAGkAAAACCQAAaAAAAAIJAABpAAAAAggFAAAAA3BtdAAAAAZhbW91bnQAAAAAAAAAAGQAAAAAAAAAAHgAAAAAAAAAABICAAAAAywwLAkAAaQAAAABBQAAAANsYmgCAAAAAywxMAUAAAADbmlsAAAAAJzsSQs=", "height": 1208712, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HNWDWgwWaVDkgwDphahtMawG5TdBaC7wYdbVJf5TBh4B Next: 431NQGi4fRG5G7GQEsSAuRnkvADkg8Eae6PZRseSVr3K Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | @Callable(i) | |
7 | 7 | func deposit () = { | |
8 | 8 | let pmt = extract(i.payment) | |
9 | - | let | |
9 | + | let lbh = lastBlock.height | |
10 | 10 | if (isDefined(pmt.assetId)) | |
11 | 11 | then throw("can hodl waves only at the moment") | |
12 | 12 | else { | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | - | let newAmount = (currentAmount + pmt.amount) | |
21 | - | if ((newAmount == pmt.amount)) | |
22 | - | then { | |
23 | - | let oldAmount = split(toString(currentAmount), ",") | |
24 | - | WriteSet([DataEntry(currentKey, (((((((oldAmount[0] + ",") + toString(((newAmount / 100) * 120))) + ",") + toString((((newAmount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",11"))]) | |
25 | - | } | |
26 | - | else WriteSet([DataEntry(currentKey, (((((((toString(pmt.amount) + ",") + toString(((pmt.amount / 100) * 120))) + ",") + toString((((pmt.amount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) | |
20 | + | WriteSet([DataEntry(currentKey, (((((((((toString(currentAmount) + ",") + toString(pmt.amount)) + ",") + toString(((pmt.amount / 100) * 120))) + ",") + toString((((pmt.amount / 100) * 120) / 18))) + ",0,") + toString(lbh)) + ",10"))]) | |
27 | 21 | } | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(i) | |
33 | - | func withdraw (amount) = { | |
34 | - | let currentKey = toBase58String(i.caller.bytes) | |
35 | - | let currentAmount = match getInteger(this, currentKey) { | |
36 | - | case a: Int => | |
37 | - | a | |
38 | - | case _ => | |
39 | - | 0 | |
40 | - | } | |
41 | - | let newAmount = (currentAmount - amount) | |
42 | - | if ((0 > amount)) | |
43 | - | then throw("Can't withdraw negative amount") | |
44 | - | else if ((0 > newAmount)) | |
45 | - | then throw("Not enough balance") | |
46 | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
47 | 22 | } | |
48 | 23 | ||
49 | 24 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func deposit () = { | |
8 | 8 | let pmt = extract(i.payment) | |
9 | - | let | |
9 | + | let lbh = lastBlock.height | |
10 | 10 | if (isDefined(pmt.assetId)) | |
11 | 11 | then throw("can hodl waves only at the moment") | |
12 | 12 | else { | |
13 | 13 | let currentKey = toBase58String(i.caller.bytes) | |
14 | 14 | let currentAmount = match getInteger(this, currentKey) { | |
15 | 15 | case a: Int => | |
16 | 16 | a | |
17 | 17 | case _ => | |
18 | 18 | 0 | |
19 | 19 | } | |
20 | - | let newAmount = (currentAmount + pmt.amount) | |
21 | - | if ((newAmount == pmt.amount)) | |
22 | - | then { | |
23 | - | let oldAmount = split(toString(currentAmount), ",") | |
24 | - | WriteSet([DataEntry(currentKey, (((((((oldAmount[0] + ",") + toString(((newAmount / 100) * 120))) + ",") + toString((((newAmount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",11"))]) | |
25 | - | } | |
26 | - | else WriteSet([DataEntry(currentKey, (((((((toString(pmt.amount) + ",") + toString(((pmt.amount / 100) * 120))) + ",") + toString((((pmt.amount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) | |
20 | + | WriteSet([DataEntry(currentKey, (((((((((toString(currentAmount) + ",") + toString(pmt.amount)) + ",") + toString(((pmt.amount / 100) * 120))) + ",") + toString((((pmt.amount / 100) * 120) / 18))) + ",0,") + toString(lbh)) + ",10"))]) | |
27 | 21 | } | |
28 | - | } | |
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | @Callable(i) | |
33 | - | func withdraw (amount) = { | |
34 | - | let currentKey = toBase58String(i.caller.bytes) | |
35 | - | let currentAmount = match getInteger(this, currentKey) { | |
36 | - | case a: Int => | |
37 | - | a | |
38 | - | case _ => | |
39 | - | 0 | |
40 | - | } | |
41 | - | let newAmount = (currentAmount - amount) | |
42 | - | if ((0 > amount)) | |
43 | - | then throw("Can't withdraw negative amount") | |
44 | - | else if ((0 > newAmount)) | |
45 | - | then throw("Not enough balance") | |
46 | - | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
47 | 22 | } | |
48 | 23 | ||
49 | 24 |
github/deemru/w8io/169f3d6 28.07 ms ◑