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