tx · CdmR5oiz4hYCEyux5WM6byAkSZGyy85d9kXxQ719LESF

3MuMCHDzoXq9BrPzNX4iojaMYsFQxmxrTMb:  -0.01400000 Waves

2020.10.08 22:48 [1212031] smart account 3MuMCHDzoXq9BrPzNX4iojaMYsFQxmxrTMb > SELF 0.00000000 Waves

{ "type": 13, "id": "CdmR5oiz4hYCEyux5WM6byAkSZGyy85d9kXxQ719LESF", "fee": 1400000, "feeAssetId": null, "timestamp": 1602186540399, "version": 2, "chainId": 84, "sender": "3MuMCHDzoXq9BrPzNX4iojaMYsFQxmxrTMb", "senderPublicKey": "EbbyzjzjzBawBS9j3M4P7Gp4Dgn6PdqDHmYS1RQ6UbbU", "proofs": [ "27AfaDwP9TjW6QVmNHAXB7kk1UpvwmDWoFySYuj6FhmHsVvkZujibPuzSD1VAeA4GGQc8MLkZSQQpmbhEZeKzKX6" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAEAAAAAA9mcm9zdEJsb2NrQ291bnQAAAAAAAAAAGQAAAAAB3BlcmNlbnQAAAAAAAAAABQBAAAADGdldFN0YXRpc3RpYwAAAAAEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAJc3RhdGlzdGljAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAADTBfMF8wXzBfMF8wXzABAAAAB2dldFVzZXIAAAABAAAABHVzZXIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAAEdXNlcgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAABcwXzBfMF8wXzBfMF8wXzBfMF8wXzBfMAAAAAIAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAA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AAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAEAAAAgHkxz8qzFYQy/gEmjfxlkGkg1N6RMNBT1/p4yXLb8QTIGIJw1Lw==", "height": 1212031, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let frostBlockCount = 100
5+
6+let percent = 20
7+
8+func getStatistic () = match getString(this, "statistic") {
9+ case a: String =>
10+ a
11+ case _ =>
12+ "0_0_0_0_0_0_0"
13+}
14+
15+
16+func getUser (user) = match getString(this, user) {
17+ case a: String =>
18+ a
19+ case _ =>
20+ "0_0_0_0_0_0_0_0_0_0_0_0"
21+}
22+
23+
24+@Callable(i)
25+func deposit () = {
26+ let pmt = extract(i.payment)
27+ if (isDefined(pmt.assetId))
28+ then throw("can hodl waves only at the moment")
29+ else {
30+ let currentKey = toBase58String(i.caller.bytes)
31+ if ((currentKey == "3N2hHaqEEXjFHE5G8NTw6v7KNMwcHob2Ena"))
32+ then WriteSet([DataEntry("statistic", getStatistic())])
33+ else {
34+ let statistic = split(getStatistic(), "_")
35+ let blockHeight = lastBlock.height
36+ let sum = ((pmt.amount / 100) * (100 + percent))
37+ let user = split(getUser(currentKey), "_")
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])), 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]) + "_") + user[11]))])
40+ }
41+ }
42+ }
43+
44+
45+
46+@Callable(i)
47+func withdraw (amount) = {
48+ let currentKey = toBase58String(i.caller.bytes)
49+ let user = split(getUser(currentKey), "_")
50+ let statistic = split(getStatistic(), "_")
51+ let oldAmount = parseIntValue(user[2])
52+ let newAmount = (oldAmount - amount)
53+ let blockHeight = lastBlock.height
54+ let frostBlockHeight = parseIntValue(user[1])
55+ let defrostBlockHeight = (frostBlockHeight + frostBlockCount)
56+ let sumWithdraw = (parseIntValue(user[2]) + amount)
57+ let maxWithdraw = if ((blockHeight >= defrostBlockHeight))
58+ then oldAmount
59+ else ((frostBlockCount - (defrostBlockHeight - blockHeight)) * (oldAmount / frostBlockCount))
60+ if ((0 > amount))
61+ then throw("Can't withdraw negative amount")
62+ else if ((amount > maxWithdraw))
63+ then throw(("Max sum: " + toString(maxWithdraw)))
64+ else if ((0 > newAmount))
65+ then throw("Not enough balance")
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+ }
68+
69+
70+@Verifier(tx)
71+func verify () = match tx {
72+ case d: SetScriptTransaction =>
73+ sigVerify(tx.bodyBytes, tx.proofs[0], base58'33Gr5uEJMDMKdRs25QUDvTeQ7q5EpGcAdPztrFvQWdv9')
74+ case _ =>
75+ true
76+}
77+

github/deemru/w8io/169f3d6 
21.80 ms