tx · HqKtN1geP5FtbPy8EE2c13YjMEmg4hDTbeKsCnFfJkis 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw: -0.01000000 Waves 2022.06.03 22:37 [2080593] smart account 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw > SELF 0.00000000 Waves
{ "type": 13, "id": "HqKtN1geP5FtbPy8EE2c13YjMEmg4hDTbeKsCnFfJkis", "fee": 1000000, "feeAssetId": null, "timestamp": 1654285094464, "version": 2, "chainId": 84, "sender": "3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw", "senderPublicKey": "GTKqLSK6nuFkRdebB5SmTwTU2DnTeLMvhymCFfT2CxX2", "proofs": [ "3oVXb2TL7CXyhd5tWDCvvPp5VdLDUBtrFThxKpDry9k14dobzexpLMRwVNDSwN7ozVj9cNnsGNswaNujGYRBdXUj" ], "script": "base64:AAIFAAAAAAAAAAYIAhIAEgAAAAACAAAAAARCVXNkAQAAACALvsj7FOtVE+sP1AaGydwZZ/QwPxANKxzHl3IsOosV4wAAAAAIZEFwcEZlZXMBAAAAGgFUpyQGvq3UMVyWnKZf8mXbUgExkWi22jMSAAAAAgAAAAFpAQAAAAxEZXBvc2l0RnVuZHMAAAAABAAAAA1Vc2VyTGlxdWlkaXR5CQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAAEX0xpcQQAAAALVXNlckJhbGFuY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAANVXNlckxpcXVpZGl0eQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAANwbXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAcQXR0YWNoZWQgcGF5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GFrZVZhbHVlAAAAAAAAAAADAAAAAAAAAAAACQAAZQAAAAIJAABlAAAAAgUAAAAGYW1vdW50CQAAaAAAAAIFAAAAB0ZlZVBhaWQAAAAAAAX14QAJAABpAAAAAgkAAGgAAAACCQAAaAAAAAIFAAAADFBhaWR0cnhWYWx1ZQAAAAAAAAAAGQkAAGUAAAACBQAAAAZhbW91bnQJAABoAAAAAgUAAAAHRmVlUGFpZAAAAAAABfXhAAAAAAAAAAAAZAQAAAAOV2l0aGRyYXdBbW91bnQJAABpAAAAAgkAAGgAAAACAAAAAAAAAAAZBQAAAAZhbW91bnQAAAAAAAAAAGQJAAUUAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAAC190cnhVbnN0YWtlBQAAAAxQYWlkdHJ4VmFsdWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAARfTGlxBQAAAAtVc2VyQWNjb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAAC190cnhVbnN0YWtlBQAAAAZoZWlnaHQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA5XaXRoZHJhd0Ftb3VudAUAAAAEQlVzZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlkQXBwRnJlZXMJAABoAAAAAgUAAAAHRmVlUGFpZAAAAAAABfXhAAUAAAAEQlVzZAUAAAADbmlsBQAAAARCVXNkAAAAAPRMRR8=", "height": 2080593, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9TzpGq4Ye3SCt2VNQ86FNLydPnotxpPcRCuKMosybJxH Next: 4a7B2T7fQN8BZWk85GStF69CrSyKjnasdxVYZeQsAUob Diff:
Old | New | Differences | |
---|---|---|---|
30 | 30 | ||
31 | 31 | ||
32 | 32 | @Callable(i) | |
33 | - | func WithdrawLiq ( | |
33 | + | func WithdrawLiq () = { | |
34 | 34 | let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq") | |
35 | 35 | let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake") | |
36 | 36 | let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake") | |
55 | 55 | case _ => | |
56 | 56 | 0 | |
57 | 57 | } | |
58 | - | let UserBalance = (amount - (UnstakedAmount * 10000000)) | |
59 | - | if ((0 >= UserBalance)) | |
58 | + | if ((amount == 0)) | |
60 | 59 | then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000)))) | |
61 | 60 | else if (if ((trxUnstakeValue == 2)) | |
62 | 61 | then (height > (trxUnstakeValue + WaitTime)) | |
63 | 62 | else false) | |
64 | 63 | then throw((("Second withdraw cannot be done before " + toString(((height - WaitTime) - trxUnstakeValue))) + " min")) | |
65 | 64 | else { | |
66 | - | let NewTrx = (trxUnstakeValue + 1) | |
67 | - | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), NewTrx), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), height), ScriptTransfer(i.caller, (UnstakedAmount * 10000000), BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
65 | + | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
66 | + | then 0 | |
67 | + | else (trxUnstakeValue + 1) | |
68 | + | let UserAccount = if ((trxUnstakeValue == 3)) | |
69 | + | then 0 | |
70 | + | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
71 | + | let WithdrawAmount = ((25 * amount) / 100) | |
72 | + | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), PaidtrxValue), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), height), ScriptTransfer(i.caller, WithdrawAmount, BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
68 | 73 | } | |
69 | 74 | } | |
70 | 75 |
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 DepositFunds () = { | |
10 | 10 | let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq") | |
11 | 11 | let UserBalance = match getInteger(this, UserLiquidity) { | |
12 | 12 | case a: Int => | |
13 | 13 | a | |
14 | 14 | case _ => | |
15 | 15 | 0 | |
16 | 16 | } | |
17 | 17 | let pmt = if ((size(i.payments) == 1)) | |
18 | 18 | then i.payments[0] | |
19 | 19 | else throw("Attached payment is required") | |
20 | 20 | if (if ((0 >= pmt.amount)) | |
21 | 21 | then true | |
22 | 22 | else (pmt.assetId != BUsd)) | |
23 | 23 | then throw("Can only deposit BUsd tokens, and amount should be positive") | |
24 | 24 | else { | |
25 | 25 | let NewBalance = (UserBalance + pmt.amount) | |
26 | 26 | [IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance)] | |
27 | 27 | } | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | 32 | @Callable(i) | |
33 | - | func WithdrawLiq ( | |
33 | + | func WithdrawLiq () = { | |
34 | 34 | let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq") | |
35 | 35 | let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake") | |
36 | 36 | let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake") | |
37 | 37 | let dAppFrees = Address(dAppFees) | |
38 | 38 | let WaitTime = 10 | |
39 | 39 | let FeePaid = 1 | |
40 | 40 | let amount = match getInteger(this, UserLiquidity) { | |
41 | 41 | case a: Int => | |
42 | 42 | a | |
43 | 43 | case _ => | |
44 | 44 | 0 | |
45 | 45 | } | |
46 | 46 | let trxUnstakeValue = match getInteger(this, trxUnstakeNum) { | |
47 | 47 | case a: Int => | |
48 | 48 | a | |
49 | 49 | case _ => | |
50 | 50 | 0 | |
51 | 51 | } | |
52 | 52 | let LastUnstakeBlockValue = match getInteger(this, LastUnstakeBlock) { | |
53 | 53 | case a: Int => | |
54 | 54 | a | |
55 | 55 | case _ => | |
56 | 56 | 0 | |
57 | 57 | } | |
58 | - | let UserBalance = (amount - (UnstakedAmount * 10000000)) | |
59 | - | if ((0 >= UserBalance)) | |
58 | + | if ((amount == 0)) | |
60 | 59 | then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000)))) | |
61 | 60 | else if (if ((trxUnstakeValue == 2)) | |
62 | 61 | then (height > (trxUnstakeValue + WaitTime)) | |
63 | 62 | else false) | |
64 | 63 | then throw((("Second withdraw cannot be done before " + toString(((height - WaitTime) - trxUnstakeValue))) + " min")) | |
65 | 64 | else { | |
66 | - | let NewTrx = (trxUnstakeValue + 1) | |
67 | - | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), NewTrx), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), height), ScriptTransfer(i.caller, (UnstakedAmount * 10000000), BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
65 | + | let PaidtrxValue = if ((trxUnstakeValue == 3)) | |
66 | + | then 0 | |
67 | + | else (trxUnstakeValue + 1) | |
68 | + | let UserAccount = if ((trxUnstakeValue == 3)) | |
69 | + | then 0 | |
70 | + | else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100)) | |
71 | + | let WithdrawAmount = ((25 * amount) / 100) | |
72 | + | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), PaidtrxValue), IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), height), ScriptTransfer(i.caller, WithdrawAmount, BUsd), ScriptTransfer(dAppFrees, (FeePaid * 100000000), BUsd)], BUsd) | |
68 | 73 | } | |
69 | 74 | } | |
70 | 75 | ||
71 | 76 |
github/deemru/w8io/026f985 32.69 ms ◑