tx · BVW23vCXtEKVhQiNT7mAVE5iEMqFdvu5uguUFuenT7Bx

3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw:  -0.01000000 Waves

2022.06.05 09:49 [2082721] smart account 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw > SELF 0.00000000 Waves

{ "type": 13, "id": "BVW23vCXtEKVhQiNT7mAVE5iEMqFdvu5uguUFuenT7Bx", "fee": 1000000, "feeAssetId": null, "timestamp": 1654411812643, "version": 2, "chainId": 84, "sender": "3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw", "senderPublicKey": "GTKqLSK6nuFkRdebB5SmTwTU2DnTeLMvhymCFfT2CxX2", "proofs": [ "3kYa7MnbqcCUfmF5GT5UY8xkA9GoR3MTwJhYGriaAs8U8spmonfD7rAgRP476ScTUFpoK5UEBRDKMb9qn8VSH7Fs" ], "script": "base64:AAIFAAAAAAAAAAgIAhIAEgASAAAAAAIAAAAABEJVc2QBAAAAIAu+yPsU61UT6w/UBobJ3Bln9DA/EA0rHMeXciw6ixXjAAAAAAhkQXBwRmVlcwEAAAAaAVSnJAa+rdQxXJacpl/yZdtSATGRaLbaMxIAAAADAAAAAWkBAAAABVJlc2V0AAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAABF9MaXEAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAxfTGFzdFVuc3Rha2UAAAAAAAAAAAAJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAtfdHJ4VW5zdGFrZQAAAAAAAAAAAAUAAAADbmlsAAAAAWkBAAAADERlcG9za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WVzCQAAaAAAAAIFAAAAB0ZlZVBhaWQAAAAAAAX14QAFAAAABEJVc2QFAAAAA25pbAUAAAAEQlVzZAAAAADlVTVi", "height": 2082721, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9DEqBQNy6gF24dGzCp6vACoGxFcSS5fvbWYV5xSTb9S Next: 9GXmGKeAVHoaPLvQ3aggYUJ8XyKWgcBE8TabPsRTvvza Diff:
OldNewDifferences
3131 then throw("Can only deposit BUsd tokens, and amount should be at least 50 BUsd")
3232 else {
3333 let NewBalance = (UserBalance + pmt.amount)
34-[IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height)]
34+[IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_Deposit"), NewBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height)]
3535 }
3636 }
3737
4242 let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq")
4343 let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake")
4444 let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake")
45+ let User1stDeposit = (toBase58String(i.caller.bytes) + "_Deposit")
4546 let dAppFrees = Address(dAppFees)
4647 let FeePaid = 1
48+ let User1stDepositValue = match getInteger(this, User1stDeposit) {
49+ case a: Int =>
50+ a
51+ case _ =>
52+ 0
53+ }
4754 let amount = match getInteger(this, UserLiquidity) {
4855 case a: Int =>
4956 a
7481 let PaidtrxValue = if ((trxUnstakeValue == 3))
7582 then 0
7683 else (trxUnstakeValue + 1)
84+ let WithdrawAmount = ((User1stDepositValue / 4) - (FeePaid * 100000000))
7785 let UserAccount = if ((trxUnstakeValue == 3))
7886 then 0
79- else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100))
80- let WithdrawAmount = ((25 * amount) / 100)
87+ else (User1stDepositValue - (PaidtrxValue * WithdrawAmount))
8188 $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)
8289 }
8390 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BUsd = base58'nrDXX1zHfGht7xExqNxDu7voCy9wzmc9vJxwcc2jLga'
55
66 let dAppFees = base58'3N59qn7Ndw24WrGFkNFk7PGTBCzdMETyKqj'
77
88 @Callable(i)
99 func Reset () = [IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), 0), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), 0), IntegerEntry((toBase58String(i.caller.bytes) + "_trxUnstake"), 0)]
1010
1111
1212
1313 @Callable(i)
1414 func DepositFunds () = {
1515 let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq")
1616 let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake")
1717 let UserBalance = match getInteger(this, UserLiquidity) {
1818 case a: Int =>
1919 a
2020 case _ =>
2121 0
2222 }
2323 let pmt = if ((size(i.payments) == 1))
2424 then i.payments[0]
2525 else throw("Attached payment is required")
2626 if ((UserBalance != 0))
2727 then throw("You already have funds supplied, cannot supply more than once")
2828 else if (if (((50 * 100000000) > pmt.amount))
2929 then true
3030 else (pmt.assetId != BUsd))
3131 then throw("Can only deposit BUsd tokens, and amount should be at least 50 BUsd")
3232 else {
3333 let NewBalance = (UserBalance + pmt.amount)
34-[IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height)]
34+[IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_Deposit"), NewBalance), IntegerEntry((toBase58String(i.caller.bytes) + "_LastUnstake"), height)]
3535 }
3636 }
3737
3838
3939
4040 @Callable(i)
4141 func WithdrawLiq () = {
4242 let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq")
4343 let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake")
4444 let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake")
45+ let User1stDeposit = (toBase58String(i.caller.bytes) + "_Deposit")
4546 let dAppFrees = Address(dAppFees)
4647 let FeePaid = 1
48+ let User1stDepositValue = match getInteger(this, User1stDeposit) {
49+ case a: Int =>
50+ a
51+ case _ =>
52+ 0
53+ }
4754 let amount = match getInteger(this, UserLiquidity) {
4855 case a: Int =>
4956 a
5057 case _ =>
5158 0
5259 }
5360 let trxUnstakeValue = match getInteger(this, trxUnstakeNum) {
5461 case a: Int =>
5562 a
5663 case _ =>
5764 0
5865 }
5966 let LastUnstakeBlockValue = match getInteger(this, LastUnstakeBlock) {
6067 case a: Int =>
6168 a
6269 case _ =>
6370 0
6471 }
6572 if ((amount == 0))
6673 then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000))))
6774 else {
6875 let WaitTime = if ((trxUnstakeValue == 0))
6976 then 2
7077 else 10
7178 if (((LastUnstakeBlockValue + WaitTime) > height))
7279 then throw((("Second withdraw cannot be done before " + toString(((height - LastUnstakeBlockValue) - WaitTime))) + " min"))
7380 else {
7481 let PaidtrxValue = if ((trxUnstakeValue == 3))
7582 then 0
7683 else (trxUnstakeValue + 1)
84+ let WithdrawAmount = ((User1stDepositValue / 4) - (FeePaid * 100000000))
7785 let UserAccount = if ((trxUnstakeValue == 3))
7886 then 0
79- else ((amount - (FeePaid * 100000000)) - (((PaidtrxValue * 25) * (amount - (FeePaid * 100000000))) / 100))
80- let WithdrawAmount = ((25 * amount) / 100)
87+ else (User1stDepositValue - (PaidtrxValue * WithdrawAmount))
8188 $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)
8289 }
8390 }
8491 }
8592
8693

github/deemru/w8io/169f3d6 
26.76 ms