tx · Cgrg89DV4jpbv6UBzU7Wyqq538vEjXaPtY3WXdHHpBwK 3MpKmkFmjoGLpPWhScheYrN7fjdJAFp9tEX: -0.01400000 Waves 2020.10.08 22:34 [1212017] smart account 3MpKmkFmjoGLpPWhScheYrN7fjdJAFp9tEX > SELF 0.00000000 Waves
{ "type": 13, "id": "Cgrg89DV4jpbv6UBzU7Wyqq538vEjXaPtY3WXdHHpBwK", "fee": 1400000, "feeAssetId": null, "timestamp": 1602185646882, "version": 2, "chainId": 84, "sender": "3MpKmkFmjoGLpPWhScheYrN7fjdJAFp9tEX", "senderPublicKey": "33Gr5uEJMDMKdRs25QUDvTeQ7q5EpGcAdPztrFvQWdv9", "proofs": [ "5NRTg73QZDATec7bYL9fhqZ6pw3XM9SQVdMGRrZKp7d5Bm49fGnJqXL785zrWDD13au4CxuZkVWBbEBJ8fdBD323" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAEAAAAAA9mcm9zdEJsb2NrQ291bnQAAAAAAAAAAGQAAAAAB3BlcmNlbnQAAAAAAAAAABQBAAAADGdldFN0YXRpc3RpYwAAAAAEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAJc3RhdGlzdGljAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAADTBfMF8wXzBfMF8wXzABAAAAB2dldFVzZXIAAAABAAAABHVzZXIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAAEdXNlcgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAABcwXzBfMF8wXzBfMF8wXzBfMF8wXzBfMAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAA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AAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAABAAAAIB5Mc/KsxWEMv4BJo38ZZBpINTekTDQU9f6eMly2/EEyBoSrVm8=", "height": 1212017, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EsX1ern73oMN1AvsHQhLWCcVauNRMJ3h5SLr3fy2oLtA Next: AfETrorqRgfDLe8aNB3cyztx4w7J6VoRCmTCmmHiUNqb Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | let sum = ((pmt.amount / 100) * (100 + percent)) | |
37 | 37 | let user = split(getUser(currentKey), "_") | |
38 | 38 | let userData2 = parseIntValue(user[2]) | |
39 | - | WriteSet([DataEntry("statistic", ((((((((((((toString((parseIntValue(statistic[0]) + pmt.amount)) + "_") + toString((parseIntValue(statistic[1]) + 1))) + "_") + statistic[2]) + "_") + statistic[3]) + "_") + statistic[4]) + "_") + statistic[5]) + "_") + statistic[6]))]) | |
39 | + | WriteSet([DataEntry("statistic", ((((((((((((toString((parseIntValue(statistic[0]) + pmt.amount)) + "_") + toString((parseIntValue(statistic[1]) + 1))) + "_") + statistic[2]) + "_") + statistic[3]) + "_") + statistic[4]) + "_") + statistic[5]) + "_") + statistic[6])), DataEntry(currentKey, (((((((((((((((((((toString((parseIntValue(user[0]) + pmt.amount)) + "_") + toString((parseIntValue(user[1]) + sum))) + "_") + toString((userData2 + sum))) + "_") + toString(((userData2 + sum) / frostBlockCount))) + "_") + toString(blockHeight)) + user[5]) + "_") + user[6]) + "_") + user[7]) + "_") + user[8]) + "_") + user[9]) + "_") + user[10]))]) | |
40 | 40 | } | |
41 | 41 | } | |
42 | 42 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let frostBlockCount = 100 | |
5 | 5 | ||
6 | 6 | let percent = 20 | |
7 | 7 | ||
8 | 8 | func getStatistic () = match getString(this, "statistic") { | |
9 | 9 | case a: String => | |
10 | 10 | a | |
11 | 11 | case _ => | |
12 | 12 | "0_0_0_0_0_0_0" | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func getUser (user) = match getString(this, user) { | |
17 | 17 | case a: String => | |
18 | 18 | a | |
19 | 19 | case _ => | |
20 | 20 | "0_0_0_0_0_0_0_0_0_0_0_0" | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func deposit () = { | |
26 | 26 | let pmt = extract(i.payment) | |
27 | 27 | if (isDefined(pmt.assetId)) | |
28 | 28 | then throw("can hodl waves only at the moment") | |
29 | 29 | else { | |
30 | 30 | let currentKey = toBase58String(i.caller.bytes) | |
31 | 31 | if ((currentKey == "3N2hHaqEEXjFHE5G8NTw6v7KNMwcHob2Ena")) | |
32 | 32 | then WriteSet([DataEntry("statistic", getStatistic())]) | |
33 | 33 | else { | |
34 | 34 | let statistic = split(getStatistic(), "_") | |
35 | 35 | let blockHeight = lastBlock.height | |
36 | 36 | let sum = ((pmt.amount / 100) * (100 + percent)) | |
37 | 37 | let user = split(getUser(currentKey), "_") | |
38 | 38 | let userData2 = parseIntValue(user[2]) | |
39 | - | WriteSet([DataEntry("statistic", ((((((((((((toString((parseIntValue(statistic[0]) + pmt.amount)) + "_") + toString((parseIntValue(statistic[1]) + 1))) + "_") + statistic[2]) + "_") + statistic[3]) + "_") + statistic[4]) + "_") + statistic[5]) + "_") + statistic[6]))]) | |
39 | + | WriteSet([DataEntry("statistic", ((((((((((((toString((parseIntValue(statistic[0]) + pmt.amount)) + "_") + toString((parseIntValue(statistic[1]) + 1))) + "_") + statistic[2]) + "_") + statistic[3]) + "_") + statistic[4]) + "_") + statistic[5]) + "_") + statistic[6])), DataEntry(currentKey, (((((((((((((((((((toString((parseIntValue(user[0]) + pmt.amount)) + "_") + toString((parseIntValue(user[1]) + sum))) + "_") + toString((userData2 + sum))) + "_") + toString(((userData2 + sum) / frostBlockCount))) + "_") + toString(blockHeight)) + user[5]) + "_") + user[6]) + "_") + user[7]) + "_") + user[8]) + "_") + user[9]) + "_") + user[10]))]) | |
40 | 40 | } | |
41 | 41 | } | |
42 | 42 | } | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | 46 | @Callable(i) | |
47 | 47 | func withdraw (amount) = { | |
48 | 48 | let currentKey = toBase58String(i.caller.bytes) | |
49 | 49 | let user = split(getUser(currentKey), "_") | |
50 | 50 | let statistic = split(getStatistic(), "_") | |
51 | 51 | let oldAmount = parseIntValue(user[2]) | |
52 | 52 | let newAmount = (oldAmount - amount) | |
53 | 53 | let blockHeight = lastBlock.height | |
54 | 54 | let frostBlockHeight = parseIntValue(user[1]) | |
55 | 55 | let defrostBlockHeight = (frostBlockHeight + frostBlockCount) | |
56 | 56 | let sumWithdraw = (parseIntValue(user[2]) + amount) | |
57 | 57 | let maxWithdraw = if ((blockHeight >= defrostBlockHeight)) | |
58 | 58 | then oldAmount | |
59 | 59 | else ((frostBlockCount - (defrostBlockHeight - blockHeight)) * (oldAmount / frostBlockCount)) | |
60 | 60 | if ((0 > amount)) | |
61 | 61 | then throw("Can't withdraw negative amount") | |
62 | 62 | else if ((amount > maxWithdraw)) | |
63 | 63 | then throw(("Max sum: " + toString(maxWithdraw))) | |
64 | 64 | else if ((0 > newAmount)) | |
65 | 65 | then throw("Not enough balance") | |
66 | 66 | else ScriptResult(WriteSet([DataEntry("statistic", (((((((((statistic[0] + "_") + statistic[1]) + "_") + toString((parseIntValue(statistic[2]) + amount))) + "_") + toString((parseIntValue(statistic[1]) + 1))) + "_") + statistic[4]) + statistic[5])), DataEntry(currentKey, ((((((((((((((((((((((user[0] + "_") + user[1]) + "_") + toString(newAmount)) + "_") + user[3]) + "_") + toString(blockHeight)) + "_") + toString((parseIntValue(user[5]) + amount))) + "_") + toString((parseIntValue(user[6]) + amount))) + "_") + user[7]) + "_") + user[8]) + "_") + user[9]) + "_") + user[10]) + "_") + user[11]))]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Verifier(tx) | |
71 | 71 | func verify () = match tx { | |
72 | 72 | case d: SetScriptTransaction => | |
73 | 73 | sigVerify(tx.bodyBytes, tx.proofs[0], base58'33Gr5uEJMDMKdRs25QUDvTeQ7q5EpGcAdPztrFvQWdv9') | |
74 | 74 | case _ => | |
75 | 75 | true | |
76 | 76 | } | |
77 | 77 |
github/deemru/w8io/169f3d6 36.31 ms ◑