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