tx · GYSsdn3X8Tv85cvGck9nh3xti2qbaYvpDbXFwpYLpvBd
3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww: -0.01400000 Waves
2020.10.04 23:02 [1206284] smart account 3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww > SELF 0.00000000 Waves
{
"type": 13,
"id": "GYSsdn3X8Tv85cvGck9nh3xti2qbaYvpDbXFwpYLpvBd",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1601841819170,
"version": 2,
"chainId": 84,
"sender": "3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww",
"senderPublicKey": "CNQtsB6HAGUVvb5L3NshmGW2pD94ysV6dzV6Zcf6BFCq",
"proofs": [
"GvWqdcbjvgn6FdKLAfMdKnLMAaZZxQDiRh6969gg3bpMP8fw6ryvLzTaCaPj1Y75GnDb56WmLYWCgTA5jZ2PMvy"
],
"script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAABHR0eHgIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACFjYW4gaG9kbCB3YXZlcyBvbmx5IGF0IHRoZSBtb21lbnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAAB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AAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGUAAAACBQAAAA1jdXJyZW50QW1vdW50BQAAAAZhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAABmFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABJOb3QgZW5vdWdoIGJhbGFuY2UJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAApjdXJyZW50S2V5BQAAAAluZXdBbW91bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAANUDtwo=",
"height": 1206284,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 2zAQ8KC6EfssexDAVmAaDwE1Ujixmtzy9LVm8Fq8msyL
Next: 6TVz36gsY7NjWnmApEvePvHv5pYsc3dRBqRZTRW6xENq
Diff:
Old | New | | Differences |
---|
18 | 18 | | 0 |
---|
19 | 19 | | } |
---|
20 | 20 | | let newAmount = (currentAmount + pmt.amount) |
---|
21 | | - | WriteSet([DataEntry(currentKey, (((((((toString(newAmount) + ",") + toString(((newAmount / 100) * 120))) + ",") + toString((((newAmount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) |
---|
| 21 | + | if ((currentAmount != 0)) |
---|
| 22 | + | then WriteSet([DataEntry(currentKey, (((((((toString((newAmount + pmt.amount)) + ",") + toString((((newAmount + pmt.amount) / 100) * 120))) + ",") + toString(((((newAmount + pmt.amount) / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) |
---|
| 23 | + | else WriteSet([DataEntry(currentKey, (((((((toString(newAmount) + ",") + toString(((newAmount / 100) * 120))) + ",") + toString((((newAmount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) |
---|
22 | 24 | | } |
---|
23 | 25 | | } |
---|
24 | 26 | | |
---|
Full:
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 | 9 | | let ttxx = 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 | 20 | | let newAmount = (currentAmount + pmt.amount) |
---|
21 | | - | WriteSet([DataEntry(currentKey, (((((((toString(newAmount) + ",") + toString(((newAmount / 100) * 120))) + ",") + toString((((newAmount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) |
---|
| 21 | + | if ((currentAmount != 0)) |
---|
| 22 | + | then WriteSet([DataEntry(currentKey, (((((((toString((newAmount + pmt.amount)) + ",") + toString((((newAmount + pmt.amount) / 100) * 120))) + ",") + toString(((((newAmount + pmt.amount) / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) |
---|
| 23 | + | else WriteSet([DataEntry(currentKey, (((((((toString(newAmount) + ",") + toString(((newAmount / 100) * 120))) + ",") + toString((((newAmount / 100) * 120) / 18))) + ",0,") + toString(ttxx)) + ",10"))]) |
---|
22 | 24 | | } |
---|
23 | 25 | | } |
---|
24 | 26 | | |
---|
25 | 27 | | |
---|
26 | 28 | | |
---|
27 | 29 | | @Callable(i) |
---|
28 | 30 | | func withdraw (amount) = { |
---|
29 | 31 | | let currentKey = toBase58String(i.caller.bytes) |
---|
30 | 32 | | let currentAmount = match getInteger(this, currentKey) { |
---|
31 | 33 | | case a: Int => |
---|
32 | 34 | | a |
---|
33 | 35 | | case _ => |
---|
34 | 36 | | 0 |
---|
35 | 37 | | } |
---|
36 | 38 | | let newAmount = (currentAmount - amount) |
---|
37 | 39 | | if ((0 > amount)) |
---|
38 | 40 | | then throw("Can't withdraw negative amount") |
---|
39 | 41 | | else if ((0 > newAmount)) |
---|
40 | 42 | | then throw("Not enough balance") |
---|
41 | 43 | | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) |
---|
42 | 44 | | } |
---|
43 | 45 | | |
---|
44 | 46 | | |
---|