tx · EsX1ern73oMN1AvsHQhLWCcVauNRMJ3h5SLr3fy2oLtA 3MpKmkFmjoGLpPWhScheYrN7fjdJAFp9tEX: -0.01400000 Waves 2020.10.08 22:29 [1212013] smart account 3MpKmkFmjoGLpPWhScheYrN7fjdJAFp9tEX > SELF 0.00000000 Waves
{ "type": 13, "id": "EsX1ern73oMN1AvsHQhLWCcVauNRMJ3h5SLr3fy2oLtA", "fee": 1400000, "feeAssetId": null, "timestamp": 1602185466447, "version": 2, "chainId": 84, "sender": "3MpKmkFmjoGLpPWhScheYrN7fjdJAFp9tEX", "senderPublicKey": "33Gr5uEJMDMKdRs25QUDvTeQ7q5EpGcAdPztrFvQWdv9", "proofs": [ "43nRWhFuRiX7es4agELzE1rBmgRj5DGvhDgQuA6UwZroyLftWCQE9oE1CiH4ujbcuAmfkW5ARwciavi5P9zLibec" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAEAAAAAA9mcm9zdEJsb2NrQ291bnQAAAAAAAAAAGQAAAAAB3BlcmNlbnQAAAAAAAAAABQBAAAADGdldFN0YXRpc3RpYwAAAAAEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAJc3RhdGlzdGljAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAADTBfMF8wXzBfMF8wXzABAAAAB2dldFVzZXIAAAABAAAABHVzZXIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAAEdXNlcgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAABcwXzBfMF8wXzBfMF8wXzBfMF8wXzBfMAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQA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TZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAAAQAAACAeTHPyrMVhDL+ASaN/GWQaSDU3pEw0FPX+njJctvxBMgYD+Wid", "height": 1212013, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8QVQi1t1PQcSguL7XCiqVshFVx9vMUsSz1k8pQr8rjgX Next: Cgrg89DV4jpbv6UBzU7Wyqq538vEjXaPtY3WXdHHpBwK 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( | |
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]))]) | |
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( | |
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]))]) | |
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 42.47 ms ◑