tx · Ghm7dMNxYZZrsRZYEtjHTVdqi4XBdnXXJp7XPqzCMyGn 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw: -0.01000000 Waves 2022.06.03 23:13 [2080632] smart account 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw > SELF 0.00000000 Waves
{ "type": 13, "id": "Ghm7dMNxYZZrsRZYEtjHTVdqi4XBdnXXJp7XPqzCMyGn", "fee": 1000000, "feeAssetId": null, "timestamp": 1654287197927, "version": 2, "chainId": 84, "sender": "3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw", "senderPublicKey": "GTKqLSK6nuFkRdebB5SmTwTU2DnTeLMvhymCFfT2CxX2", "proofs": [ "29khLPCKXEj5WuSTH8Pk4ABfrwZG9E6tN8nPAt7HpqMfxTRUmqUbdM5AF97HRvjwnMU8fiQf6HEkfcUEEYQjSbPS" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAAIAAAAABEJVc2QBAAAAIAu+yPsU61UT6w/UBobJ3Bln9DA/EA0rHMeXciw6ixXjAAAAAAhkQXBwRmVlcwEAAAAaAVSnJAa+rdQxXJacpl/yZdtSATGRaLbaMxIAAAADAAAAAWkBAAAABVJlc2V0AAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAABF9MaXEAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAxfTGFzdFVuc3Rha2UAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAtfdHJ4VW5zdGFrZQAAAAAAAAAAAAUAAAADbmlsAAAAAWkBAAAAD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AAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAAMX0xhc3RVbnN0YWtlBQAAAAZoZWlnaHQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA5XaXRoZHJhd0Ftb3VudAUAAAAEQlVzZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlkQXBwRnJlZXMJAABoAAAAAgUAAAAHRmVlUGFpZAAAAAAABfXhAAUAAAAEQlVzZAUAAAADbmlsBQAAAARCVXNkAAAAALWnf80=", "height": 2080632, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GQ7S5FzPiZcUeV5am3HjxW8ykU4iqZBueSuTew41U8JL Next: 4Z7mFoj75aoEXJUtJf5bc6M29zRCPeiofN17BWHPWyiA Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | if ((amount == 0)) | |
64 | 64 | then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000)))) | |
65 | 65 | else if (if ((trxUnstakeValue == 2)) | |
66 | - | then ( | |
66 | + | then ((LastUnstakeBlockValue + WaitTime) > height) | |
67 | 67 | else false) | |
68 | - | then throw((("Second withdraw cannot be done before " + toString(height)) + " min")) | |
68 | + | then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min")) | |
69 | 69 | else { | |
70 | 70 | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
71 | 71 | then 0 |
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 ((0 >= 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 positive") | |
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 | 43 | let WaitTime = 10 | |
44 | 44 | let FeePaid = 1 | |
45 | 45 | let amount = match getInteger(this, UserLiquidity) { | |
46 | 46 | case a: Int => | |
47 | 47 | a | |
48 | 48 | case _ => | |
49 | 49 | 0 | |
50 | 50 | } | |
51 | 51 | let trxUnstakeValue = match getInteger(this, trxUnstakeNum) { | |
52 | 52 | case a: Int => | |
53 | 53 | a | |
54 | 54 | case _ => | |
55 | 55 | 0 | |
56 | 56 | } | |
57 | 57 | let LastUnstakeBlockValue = match getInteger(this, LastUnstakeBlock) { | |
58 | 58 | case a: Int => | |
59 | 59 | a | |
60 | 60 | case _ => | |
61 | 61 | 0 | |
62 | 62 | } | |
63 | 63 | if ((amount == 0)) | |
64 | 64 | then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000)))) | |
65 | 65 | else if (if ((trxUnstakeValue == 2)) | |
66 | - | then ( | |
66 | + | then ((LastUnstakeBlockValue + WaitTime) > height) | |
67 | 67 | else false) | |
68 | - | then throw((("Second withdraw cannot be done before " + toString(height)) + " min")) | |
68 | + | then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min")) | |
69 | 69 | else { | |
70 | 70 | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
71 | 71 | then 0 | |
72 | 72 | else (trxUnstakeValue + 1) | |
73 | 73 | let UserAccount = if ((trxUnstakeValue == 3)) | |
74 | 74 | then 0 | |
75 | 75 | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
76 | 76 | let WithdrawAmount = ((25 * amount) / 100) | |
77 | 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 | 78 | } | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 |
github/deemru/w8io/026f985 29.82 ms ◑