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