tx · BCFdp41PNuLxpN8ysjKYA3fMmMkYx1gaZdonzi5JYnWc

3N8XBzcbxt5snTdkqVSobDjtDGbTns27DdY:  -0.01400000 Waves

2020.10.06 19:36 [1208953] smart account 3N8XBzcbxt5snTdkqVSobDjtDGbTns27DdY > SELF 0.00000000 Waves

{ "type": 13, "id": "BCFdp41PNuLxpN8ysjKYA3fMmMkYx1gaZdonzi5JYnWc", "fee": 1400000, "feeAssetId": null, "timestamp": 1602002226935, "version": 2, "chainId": 84, "sender": "3N8XBzcbxt5snTdkqVSobDjtDGbTns27DdY", "senderPublicKey": "HhWoKsFPjXVx9nYfPydpV9BwLmuUdJyJ8ydtyVJVxg9Z", "proofs": [ "42fTW2FnwvQMaYVGBpKQQ15oLVoJoD2gSwP7Q7EWzAj7WRmkBziW8zbvcq9QmpYqpEHXqXLwRpmbZHzLLbr53M13" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQEAAAAAAAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAAC2Jsb2NrSGVpZ2h0CAUAAAAJbGFzdEJsb2NrAAAABmhlaWdodAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAhY2FuIGhvZGwgd2F2ZXMgb25seSBhdCB0aGUgbW9tZW50BAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMDCQEAAAABIQAAAAEJAQAAAAlpc0RlZmluZWQAAAABCQAEHQAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAGkAAAAAQkAAGgAAAACCQAAaQAAAAIIBQAAAANwbXQA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AAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAGkAAAAAQUAAAAJbmV3QW1vdW50AgAAAAFfCQABkQAAAAIFAAAAB29sZERhdGEAAAAAAAAAAAECAAAAAV8JAAGkAAAAAQUAAAALc3VtV2l0aGRyYXcCAAAAGF9mcm9tLXRlc3QobWF4V2l0aGRyYXcpOgkAAaQAAAABBQAAAAttYXhXaXRoZHJhdwIAAAAoX3x8fHx8fHx8fHx8fHx8fHx8fHx8X2Zyb20tdGVzdChhbW91bnQpOgkAAaQAAAABBQAAAAZhbW91bnQCAAAAIF9mcm9tLXRlc3QoYmxvY2stYWZ0ZXItZGVwb3NpdCk6CQABpAAAAAEJAABlAAAAAgUAAAAPZnJvc3RCbG9ja0NvdW50CQAAZQAAAAIFAAAAEmRlZnJvc3RCbG9ja0hlaWdodAUAAAALYmxvY2tIZWlnaHQCAAAAGl9mcm9tLXRlc3Qoc3VtLWZvci1ibG9jayk6CQABpAAAAAEJAABpAAAAAgUAAAAJb2xkQW1vdW50BQAAAA9mcm9zdEJsb2NrQ291bnQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABmFtb3VudAUAAAAEdW5pdAUAAAADbmlsAAAAAJfc0kY=", "height": 1208953, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GcaULHuNRe2S2SRyivvLZCwcrKPzCnCd3uVzNxvHFxhF Next: 7f1Pq4yXqoxPoecpZChA3DZKTBvQYSWWYyqWLZQXfpru Diff:
OldNewDifferences
2121 throw("error")
2222 }, "_")
2323 let currentAmount = parseIntValue(oldData[0])
24- WriteSet([DataEntry(currentKey, ((((toString((currentAmount + ((pmt.amount / 100) * 120))) + "_") + toString(blockHeight)) + "_") + oldData[2]))])
24+ WriteSet([DataEntry(currentKey, ((((toString((currentAmount + ((pmt.amount / 100) * 12000))) + "_") + toString(blockHeight)) + "_") + oldData[2]))])
2525 }
2626 }
2727 }
3030
3131 @Callable(i)
3232 func withdraw (amount) = {
33- let frostBlockCount = 100
33+ let frostBlockCount = 1
3434 let currentKey = toBase58String(i.caller.bytes)
3535 let oldData = split( match getString(this, currentKey) {
3636 case str: String =>
5353 then throw(("Max sum: " + toString(maxWithdraw)))
5454 else if ((0 > newAmount))
5555 then throw("Not enough balance")
56- else ScriptResult(WriteSet([DataEntry(currentKey, ((((((((((((toString(newAmount) + "_") + oldData[1]) + "_") + toString(sumWithdraw)) + "_from-test(maxWithdraw):") + toString(maxWithdraw)) + "_from-test(amount):") + toString(amount)) + "_from-test(block-after-deposit):") + toString((frostBlockCount - (defrostBlockHeight - blockHeight)))) + "_from-test(sum-for-block):") + toString((oldAmount / frostBlockCount))))]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
56+ else ScriptResult(WriteSet([DataEntry(currentKey, ((((((((((((toString(newAmount) + "_") + oldData[1]) + "_") + toString(sumWithdraw)) + "_from-test(maxWithdraw):") + toString(maxWithdraw)) + "_||||||||||||||||||||_from-test(amount):") + toString(amount)) + "_from-test(block-after-deposit):") + toString((frostBlockCount - (defrostBlockHeight - blockHeight)))) + "_from-test(sum-for-block):") + toString((oldAmount / frostBlockCount))))]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
5757 }
5858
5959
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func deposit () = {
88 let pmt = extract(i.payment)
99 let blockHeight = lastBlock.height
1010 if (isDefined(pmt.assetId))
1111 then throw("can hodl waves only at the moment")
1212 else {
1313 let currentKey = toBase58String(i.caller.bytes)
1414 if (!(isDefined(getString(this, currentKey))))
1515 then WriteSet([DataEntry(currentKey, (((toString(((pmt.amount / 100) * 120)) + "_") + toString(blockHeight)) + "_0"))])
1616 else {
1717 let oldData = split( match getString(this, currentKey) {
1818 case str: String =>
1919 str
2020 case _ =>
2121 throw("error")
2222 }, "_")
2323 let currentAmount = parseIntValue(oldData[0])
24- WriteSet([DataEntry(currentKey, ((((toString((currentAmount + ((pmt.amount / 100) * 120))) + "_") + toString(blockHeight)) + "_") + oldData[2]))])
24+ WriteSet([DataEntry(currentKey, ((((toString((currentAmount + ((pmt.amount / 100) * 12000))) + "_") + toString(blockHeight)) + "_") + oldData[2]))])
2525 }
2626 }
2727 }
2828
2929
3030
3131 @Callable(i)
3232 func withdraw (amount) = {
33- let frostBlockCount = 100
33+ let frostBlockCount = 1
3434 let currentKey = toBase58String(i.caller.bytes)
3535 let oldData = split( match getString(this, currentKey) {
3636 case str: String =>
3737 str
3838 case _ =>
3939 throw("error")
4040 }, "_")
4141 let oldAmount = parseIntValue(oldData[0])
4242 let newAmount = (oldAmount - amount)
4343 let blockHeight = lastBlock.height
4444 let frostBlockHeight = parseIntValue(oldData[1])
4545 let defrostBlockHeight = (frostBlockHeight + frostBlockCount)
4646 let sumWithdraw = (parseIntValue(oldData[2]) + amount)
4747 let maxWithdraw = if ((blockHeight >= defrostBlockHeight))
4848 then oldAmount
4949 else ((frostBlockCount - (defrostBlockHeight - blockHeight)) * (oldAmount / frostBlockCount))
5050 if ((0 > amount))
5151 then throw("Can't withdraw negative amount")
5252 else if ((amount > maxWithdraw))
5353 then throw(("Max sum: " + toString(maxWithdraw)))
5454 else if ((0 > newAmount))
5555 then throw("Not enough balance")
56- else ScriptResult(WriteSet([DataEntry(currentKey, ((((((((((((toString(newAmount) + "_") + oldData[1]) + "_") + toString(sumWithdraw)) + "_from-test(maxWithdraw):") + toString(maxWithdraw)) + "_from-test(amount):") + toString(amount)) + "_from-test(block-after-deposit):") + toString((frostBlockCount - (defrostBlockHeight - blockHeight)))) + "_from-test(sum-for-block):") + toString((oldAmount / frostBlockCount))))]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
56+ else ScriptResult(WriteSet([DataEntry(currentKey, ((((((((((((toString(newAmount) + "_") + oldData[1]) + "_") + toString(sumWithdraw)) + "_from-test(maxWithdraw):") + toString(maxWithdraw)) + "_||||||||||||||||||||_from-test(amount):") + toString(amount)) + "_from-test(block-after-deposit):") + toString((frostBlockCount - (defrostBlockHeight - blockHeight)))) + "_from-test(sum-for-block):") + toString((oldAmount / frostBlockCount))))]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
5757 }
5858
5959

github/deemru/w8io/169f3d6 
27.34 ms