tx · GxM4qFtDdinkoY1DQcQA2bp2Gb212wxVtwqKTnNBipyc 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw: -0.01000000 Waves 2022.06.04 18:09 [2081764] smart account 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw > SELF 0.00000000 Waves
{ "type": 13, "id": "GxM4qFtDdinkoY1DQcQA2bp2Gb212wxVtwqKTnNBipyc", "fee": 1000000, "feeAssetId": null, "timestamp": 1654355362227, "version": 2, "chainId": 84, "sender": "3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw", "senderPublicKey": "GTKqLSK6nuFkRdebB5SmTwTU2DnTeLMvhymCFfT2CxX2", "proofs": [ "aCqAj1eSLHtDcWFsR4iKdJubicdwzhaWU5TXAdFnbtzNXcGQnXcCdQoPLoe1kowbjSdWUYq8BeHVrSS4nhHd9oc" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAAIAAAAABEJVc2QBAAAAIAu+yPsU61UT6w/UBobJ3Bln9DA/EA0rHMeXciw6ixXjAAAAAAhkQXBwRmVlcwEAAAAaAVSnJAa+rdQxXJacpl/yZdtSATGRaLbaMxIAAAADAAAAAWkBAAAABVJlc2V0AAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAABF9MaXEAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAxfTGFzdFVuc3Rha2UAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAtfdHJ4VW5zdGFrZQAAAAAAAAAAAAUAAAADbmlsAAAAAWkBAAAADERlcG9zaXRG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AAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAABF9MaXEFAAAAC1VzZXJBY2NvdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAAMX0xhc3RVbnN0YWtlBQAAAAZoZWlnaHQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA5XaXRoZHJhd0Ftb3VudAUAAAAEQlVzZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlkQXBwRnJlZXMJAABoAAAAAgUAAAAHRmVlUGFpZAAAAAAABfXhAAUAAAAEQlVzZAUAAAADbmlsBQAAAARCVXNkAAAAAJOwBv4=", "height": 2081764, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4Z7mFoj75aoEXJUtJf5bc6M29zRCPeiofN17BWHPWyiA Next: DfsqqyYPWde1Er46gYZdjXSw4p6uy8HGMLxcvKftvMP6 Diff:
Old | New | Differences | |
---|---|---|---|
40 | 40 | let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake") | |
41 | 41 | let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake") | |
42 | 42 | let dAppFrees = Address(dAppFees) | |
43 | - | let WaitTime = 10 | |
44 | 43 | let FeePaid = 1 | |
45 | 44 | let amount = match getInteger(this, UserLiquidity) { | |
46 | 45 | case a: Int => | |
62 | 61 | } | |
63 | 62 | if ((amount == 0)) | |
64 | 63 | then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000)))) | |
65 | - | else if (if ((trxUnstakeValue == 2)) | |
66 | - | then ((LastUnstakeBlockValue + WaitTime) > height) | |
67 | - | else false) | |
68 | - | then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min")) | |
69 | - | else { | |
70 | - | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
71 | - | then 0 | |
72 | - | else (trxUnstakeValue + 1) | |
73 | - | let UserAccount = if ((trxUnstakeValue == 3)) | |
74 | - | then 0 | |
75 | - | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
76 | - | let WithdrawAmount = ((25 * amount) / 100) | |
77 | - | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), PaidtrxValue), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height), ScriptTransfer(i.caller, WithdrawAmount, BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
78 | - | } | |
64 | + | else { | |
65 | + | let WaitTime = if ((trxUnstakeValue == 1)) | |
66 | + | then 2 | |
67 | + | else 10 | |
68 | + | if (if ((trxUnstakeValue == 2)) | |
69 | + | then ((LastUnstakeBlockValue + WaitTime) > height) | |
70 | + | else false) | |
71 | + | then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min")) | |
72 | + | else { | |
73 | + | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
74 | + | then 0 | |
75 | + | else (trxUnstakeValue + 1) | |
76 | + | let UserAccount = if ((trxUnstakeValue == 3)) | |
77 | + | then 0 | |
78 | + | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
79 | + | let WithdrawAmount = ((25 * amount) / 100) | |
80 | + | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), PaidtrxValue), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height), ScriptTransfer(i.caller, WithdrawAmount, BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
81 | + | } | |
82 | + | } | |
79 | 83 | } | |
80 | 84 | ||
81 | 85 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BUsd = base58'nrDXX1zHfGht7xExqNxDu7voCy9wzmc9vJxwcc2jLga' | |
5 | 5 | ||
6 | 6 | let dAppFees = base58'3N59qn7Ndw24WrGFkNFk7PGTBCzdMETyKqj' | |
7 | 7 | ||
8 | 8 | @Callable(i) | |
9 | 9 | func Reset () = [IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), 0), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), 0), IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), 0)] | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | ||
13 | 13 | @Callable(i) | |
14 | 14 | func DepositFunds () = { | |
15 | 15 | let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq") | |
16 | 16 | let UserBalance = match getInteger(this, UserLiquidity) { | |
17 | 17 | case a: Int => | |
18 | 18 | a | |
19 | 19 | case _ => | |
20 | 20 | 0 | |
21 | 21 | } | |
22 | 22 | let pmt = if ((size(i.payments) == 1)) | |
23 | 23 | then i.payments[0] | |
24 | 24 | else throw("Attached payment is required") | |
25 | 25 | if (if (((50 * 100000000) > pmt.amount)) | |
26 | 26 | then true | |
27 | 27 | else (pmt.assetId != BUsd)) | |
28 | 28 | then throw("Can only deposit BUsd tokens, and amount should be at least 50 BUsd") | |
29 | 29 | else { | |
30 | 30 | let NewBalance = (UserBalance + pmt.amount) | |
31 | 31 | [IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance)] | |
32 | 32 | } | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | 37 | @Callable(i) | |
38 | 38 | func WithdrawLiq () = { | |
39 | 39 | let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq") | |
40 | 40 | let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake") | |
41 | 41 | let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake") | |
42 | 42 | let dAppFrees = Address(dAppFees) | |
43 | - | let WaitTime = 10 | |
44 | 43 | let FeePaid = 1 | |
45 | 44 | let amount = match getInteger(this, UserLiquidity) { | |
46 | 45 | case a: Int => | |
47 | 46 | a | |
48 | 47 | case _ => | |
49 | 48 | 0 | |
50 | 49 | } | |
51 | 50 | let trxUnstakeValue = match getInteger(this, trxUnstakeNum) { | |
52 | 51 | case a: Int => | |
53 | 52 | a | |
54 | 53 | case _ => | |
55 | 54 | 0 | |
56 | 55 | } | |
57 | 56 | let LastUnstakeBlockValue = match getInteger(this, LastUnstakeBlock) { | |
58 | 57 | case a: Int => | |
59 | 58 | a | |
60 | 59 | case _ => | |
61 | 60 | 0 | |
62 | 61 | } | |
63 | 62 | if ((amount == 0)) | |
64 | 63 | then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000)))) | |
65 | - | else if (if ((trxUnstakeValue == 2)) | |
66 | - | then ((LastUnstakeBlockValue + WaitTime) > height) | |
67 | - | else false) | |
68 | - | then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min")) | |
69 | - | else { | |
70 | - | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
71 | - | then 0 | |
72 | - | else (trxUnstakeValue + 1) | |
73 | - | let UserAccount = if ((trxUnstakeValue == 3)) | |
74 | - | then 0 | |
75 | - | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
76 | - | let WithdrawAmount = ((25 * amount) / 100) | |
77 | - | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), PaidtrxValue), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height), ScriptTransfer(i.caller, WithdrawAmount, BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
78 | - | } | |
64 | + | else { | |
65 | + | let WaitTime = if ((trxUnstakeValue == 1)) | |
66 | + | then 2 | |
67 | + | else 10 | |
68 | + | if (if ((trxUnstakeValue == 2)) | |
69 | + | then ((LastUnstakeBlockValue + WaitTime) > height) | |
70 | + | else false) | |
71 | + | then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min")) | |
72 | + | else { | |
73 | + | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
74 | + | then 0 | |
75 | + | else (trxUnstakeValue + 1) | |
76 | + | let UserAccount = if ((trxUnstakeValue == 3)) | |
77 | + | then 0 | |
78 | + | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
79 | + | let WithdrawAmount = ((25 * amount) / 100) | |
80 | + | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), PaidtrxValue), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height), ScriptTransfer(i.caller, WithdrawAmount, BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
81 | + | } | |
82 | + | } | |
79 | 83 | } | |
80 | 84 | ||
81 | 85 |
github/deemru/w8io/169f3d6 48.27 ms ◑