tx · HNWDWgwWaVDkgwDphahtMawG5TdBaC7wYdbVJf5TBh4B
3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww: -0.01400000 Waves
2020.10.04 23:36 [1206317] smart account 3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww > SELF 0.00000000 Waves
{
"type": 13,
"id": "HNWDWgwWaVDkgwDphahtMawG5TdBaC7wYdbVJf5TBh4B",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1601843773996,
"version": 2,
"chainId": 84,
"sender": "3NCv9hyL5NUbMMkTXYnN9hL9AMQd6f2eVww",
"senderPublicKey": "CNQtsB6HAGUVvb5L3NshmGW2pD94ysV6dzV6Zcf6BFCq",
"proofs": [
"3bF1f1g4zwXSx7RVrkK5xUMJycXemeReGe9YNj6KhKSbK5R8EhXvNtSd8b5jJSr4iTF8fTpPz8McqwjGrBbYZuej"
],
"script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAABHR0eHgIBQAAAAlsYXN0QmxvY2sAAAAGaGVpZ2h0AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAACFjYW4gaG9kbCB3YXZlcyBvbmx5IGF0IHRoZSBtb21lbnQEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAApjdXJyZW50S2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACW5ld0Ftb3VudAkAAGQAAAACBQAAAA1jdXJyZW50QW1vdW50CAUAAAADcG10AAAABmFtb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AAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZQAAAAIFAAAADWN1cnJlbnRBbW91bnQFAAAABmFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAGYW1vdW50CQAAAgAAAAECAAAAHkNhbid0IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAJbmV3QW1vdW50CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkFAAAACW5ld0Ftb3VudAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAAAcFDq1Q==",
"height": 1206317,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 6M1xCGMJ85Zx3VCDXdoqXk8bMF2ThaZHcf3E6DAV2eyp
Next: 6LXguuSvnAfubUNFFWoxAc55QXzaPM8S6S1YPo4krp86
Diff:
Old | New | | Differences |
---|
20 | 20 | | } |
---|
21 | 21 | | else 0 |
---|
22 | 22 | | } |
---|
23 | | - | if ((e > 0)) |
---|
| 23 | + | let h = (e + b.amount) |
---|
| 24 | + | if ((h == b.amount)) |
---|
24 | 25 | | then { |
---|
25 | | - | let h = split(toString(e), ",") |
---|
26 | | - | let i = (e + b.amount) |
---|
27 | | - | WriteSet([DataEntry(d, (((((((h[0] + ",") + toString(((i / 100) * 120))) + ",") + toString((((i / 100) * 120) / 18))) + ",0,") + toString(c)) + ",11"))]) |
---|
| 26 | + | let i = split(toString(e), ",") |
---|
| 27 | + | WriteSet([DataEntry(d, (((((((i[0] + ",") + toString(((h / 100) * 120))) + ",") + toString((((h / 100) * 120) / 18))) + ",0,") + toString(c)) + ",11"))]) |
---|
28 | 28 | | } |
---|
29 | 29 | | else WriteSet([DataEntry(d, (((((((toString(b.amount) + ",") + toString(((b.amount / 100) * 120))) + ",") + toString((((b.amount / 100) * 120) / 18))) + ",0,") + toString(c)) + ",10"))]) |
---|
30 | 30 | | } |
---|
|
44 | 44 | | } |
---|
45 | 45 | | else 0 |
---|
46 | 46 | | } |
---|
47 | | - | let i = (e - j) |
---|
| 47 | + | let h = (e - j) |
---|
48 | 48 | | if ((0 > j)) |
---|
49 | 49 | | then throw("Can't withdraw negative amount") |
---|
50 | | - | else if ((0 > i)) |
---|
| 50 | + | else if ((0 > h)) |
---|
51 | 51 | | then throw("Not enough balance") |
---|
52 | | - | else ScriptResult(WriteSet([DataEntry(d, i)]), TransferSet([ScriptTransfer(a.caller, j, unit)])) |
---|
| 52 | + | else ScriptResult(WriteSet([DataEntry(d, h)]), TransferSet([ScriptTransfer(a.caller, j, unit)])) |
---|
53 | 53 | | } |
---|
54 | 54 | | |
---|
55 | 55 | | |
---|
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(a) |
---|
7 | 7 | | func deposit () = { |
---|
8 | 8 | | let b = extract(a.payment) |
---|
9 | 9 | | let c = lastBlock.height |
---|
10 | 10 | | if (isDefined(b.assetId)) |
---|
11 | 11 | | then throw("can hodl waves only at the moment") |
---|
12 | 12 | | else { |
---|
13 | 13 | | let d = toBase58String(a.caller.bytes) |
---|
14 | 14 | | let e = { |
---|
15 | 15 | | let f = getInteger(this, d) |
---|
16 | 16 | | if ($isInstanceOf(f, "Int")) |
---|
17 | 17 | | then { |
---|
18 | 18 | | let g = f |
---|
19 | 19 | | g |
---|
20 | 20 | | } |
---|
21 | 21 | | else 0 |
---|
22 | 22 | | } |
---|
23 | | - | if ((e > 0)) |
---|
| 23 | + | let h = (e + b.amount) |
---|
| 24 | + | if ((h == b.amount)) |
---|
24 | 25 | | then { |
---|
25 | | - | let h = split(toString(e), ",") |
---|
26 | | - | let i = (e + b.amount) |
---|
27 | | - | WriteSet([DataEntry(d, (((((((h[0] + ",") + toString(((i / 100) * 120))) + ",") + toString((((i / 100) * 120) / 18))) + ",0,") + toString(c)) + ",11"))]) |
---|
| 26 | + | let i = split(toString(e), ",") |
---|
| 27 | + | WriteSet([DataEntry(d, (((((((i[0] + ",") + toString(((h / 100) * 120))) + ",") + toString((((h / 100) * 120) / 18))) + ",0,") + toString(c)) + ",11"))]) |
---|
28 | 28 | | } |
---|
29 | 29 | | else WriteSet([DataEntry(d, (((((((toString(b.amount) + ",") + toString(((b.amount / 100) * 120))) + ",") + toString((((b.amount / 100) * 120) / 18))) + ",0,") + toString(c)) + ",10"))]) |
---|
30 | 30 | | } |
---|
31 | 31 | | } |
---|
32 | 32 | | |
---|
33 | 33 | | |
---|
34 | 34 | | |
---|
35 | 35 | | @Callable(a) |
---|
36 | 36 | | func withdraw (j) = { |
---|
37 | 37 | | let d = toBase58String(a.caller.bytes) |
---|
38 | 38 | | let e = { |
---|
39 | 39 | | let f = getInteger(this, d) |
---|
40 | 40 | | if ($isInstanceOf(f, "Int")) |
---|
41 | 41 | | then { |
---|
42 | 42 | | let g = f |
---|
43 | 43 | | g |
---|
44 | 44 | | } |
---|
45 | 45 | | else 0 |
---|
46 | 46 | | } |
---|
47 | | - | let i = (e - j) |
---|
| 47 | + | let h = (e - j) |
---|
48 | 48 | | if ((0 > j)) |
---|
49 | 49 | | then throw("Can't withdraw negative amount") |
---|
50 | | - | else if ((0 > i)) |
---|
| 50 | + | else if ((0 > h)) |
---|
51 | 51 | | then throw("Not enough balance") |
---|
52 | | - | else ScriptResult(WriteSet([DataEntry(d, i)]), TransferSet([ScriptTransfer(a.caller, j, unit)])) |
---|
| 52 | + | else ScriptResult(WriteSet([DataEntry(d, h)]), TransferSet([ScriptTransfer(a.caller, j, unit)])) |
---|
53 | 53 | | } |
---|
54 | 54 | | |
---|
55 | 55 | | |
---|