tx · 9TzpGq4Ye3SCt2VNQ86FNLydPnotxpPcRCuKMosybJxH

3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw:  -0.01000000 Waves

2022.06.03 22:28 [2080584] smart account 3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw > SELF 0.00000000 Waves

{ "type": 13, "id": "9TzpGq4Ye3SCt2VNQ86FNLydPnotxpPcRCuKMosybJxH", "fee": 1000000, "feeAssetId": null, "timestamp": 1654284531020, "version": 2, "chainId": 84, "sender": "3N7nJwbFGppbebBtXy6bWVcQCGu7m3kXFaw", "senderPublicKey": "GTKqLSK6nuFkRdebB5SmTwTU2DnTeLMvhymCFfT2CxX2", "proofs": [ "2MW3gJBjgKpmPoLrM2kp2KWWhXJZLqG6hxXfdzWXhH2ks6ooKvL6wjKhRiPK7ok8SZh1PFH6p9tKFPbDfppYJPw2" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAACAAAAAARCVXNkAQAAACALvsj7FOtVE+sP1AaGydwZZ/QwPxANKxzHl3IsOosV4wAAAAAIZEFwcEZlZXMBAAAAGgFUpyQGvq3UMVyWnKZf8mXbUgExkWi22jMSAAAAAgAAAAFpAQAAAAxEZXBvc2l0RnVuZHMAAAAABAAAAA1Vc2VyTGlxdWlkaXR5CQABLAAAAAIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAAEX0xpcQQAAAALVXNlckJhbGFuY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAANVXNlckxpcXVpZGl0eQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABAAAAANwbXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAEJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAcQXR0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AAAAAAAAEJAAUUAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAAC190cnhVbnN0YWtlBQAAAAZOZXdUcngJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAARfTGlxBQAAAAtVc2VyQmFsYW5jZQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMCAAAAC190cnhVbnN0YWtlBQAAAAZoZWlnaHQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyCQAAaAAAAAIFAAAADlVuc3Rha2VkQW1vdW50AAAAAAAAmJaABQAAAARCVXNkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAACWRBcHBGcmVlcwkAAGgAAAACBQAAAAdGZWVQYWlkAAAAAAAF9eEABQAAAARCVXNkBQAAAANuaWwFAAAABEJVc2QAAAAAMXWGRw==", "height": 2080584, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7JRA5pYAQBSXo2GJqALxTEkQzuvVpXFeRqD9zUfT8wQk Next: HqKtN1geP5FtbPy8EE2c13YjMEmg4hDTbeKsCnFfJkis Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let BUsd = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
5-
6-let USDT = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
7-
8-let USDC = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
9-
10-let BTC = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
11-
12-let ETH = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
13-
14-let BNB = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
15-
16-let USDN = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
17-
18-let HASH = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
19-
20-let KUSD = base58'HFLaeLdjg9cASsYhvwM9PV3NcCxa3UeVa5KvfYUPQYgJ'
4+let BUsd = base58'nrDXX1zHfGht7xExqNxDu7voCy9wzmc9vJxwcc2jLga'
215
226 let dAppFees = base58'3N59qn7Ndw24WrGFkNFk7PGTBCzdMETyKqj'
237
24-let AdmindApp = base58'3MzqbY4iHg79pg4DNLK6UXUsbPuDcoJTzLw'
25-
268 @Callable(i)
27-func DepositFunds (ScopeDesc,Deliverables,FreelancerAddress) = {
28- let FreeLancerPayment = (toBase58String(i.caller.bytes) + "_Payment")
29- let amount = match getInteger(this, FreeLancerPayment) {
9+func DepositFunds () = {
10+ let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq")
11+ let UserBalance = match getInteger(this, UserLiquidity) {
3012 case a: Int =>
3113 a
3214 case _ =>
3315 0
3416 }
35- if ((amount != 0))
36- then throw("You have already deposited funds, deposits can only be done once")
17+ let pmt = if ((size(i.payments) == 1))
18+ then i.payments[0]
19+ else throw("Attached payment is required")
20+ if (if ((0 >= pmt.amount))
21+ then true
22+ else (pmt.assetId != BUsd))
23+ then throw("Can only deposit BUsd tokens, and amount should be positive")
3724 else {
38- let pmt = if ((size(i.payments) == 1))
39- then i.payments[0]
40- else throw("Attached payment is required")
41- if (if (if (if (if (if (if (if (if (if (if ((0 >= pmt.amount))
42- then (pmt.assetId != BUsd)
43- else false)
44- then (pmt.assetId != USDT)
45- else false)
46- then (pmt.assetId != USDC)
47- else false)
48- then (pmt.assetId != BTC)
49- else false)
50- then (pmt.assetId != ETH)
51- else false)
52- then (pmt.assetId != BNB)
53- else false)
54- then (pmt.assetId != USDN)
55- else false)
56- then (pmt.assetId != HASH)
57- else false)
58- then (pmt.assetId != KUSD)
59- else false)
60- then isDefined(pmt.assetId)
61- else false)
62- then throw("Can only deposit accepted tokens, and amount should be positive")
63- else if (if (if ((ScopeDesc == ""))
64- then true
65- else (Deliverables == ""))
66- then true
67- else (FreelancerAddress == ""))
68- then throw("Job Scope, Deliverables desc and Freelancer Wallet Address cannot be empty")
69- else {
70- let AssetUsed = if (isDefined(pmt.assetId))
71- then toBase58String(value(pmt.assetId))
72- else "Waves"
73-[StringEntry((toBase58String(i.caller.bytes) + "_Scope"), ScopeDesc), StringEntry((toBase58String(i.caller.bytes) + "_Deliv"), Deliverables), StringEntry((toBase58String(i.caller.bytes) + "_Asset"), AssetUsed), StringEntry((toBase58String(i.caller.bytes) + "_Freelancer"), FreelancerAddress), IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), pmt.amount)]
74- }
25+ let NewBalance = (UserBalance + pmt.amount)
26+[IntegerEntry((toBase58String(i.caller.bytes) + "_Liq"), NewBalance)]
7527 }
7628 }
7729
7830
7931
8032 @Callable(i)
81-func PayFreelancer (PayFreelancer) = {
82- let FreeLancerPayment = (toBase58String(i.caller.bytes) + "_Payment")
83- let FreelancerAddress = (toBase58String(i.caller.bytes) + "_Freelancer")
84- let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset")
85- let Paidtrx = (toBase58String(i.caller.bytes) + "_Paidtrx")
86- let amount = match getInteger(this, FreeLancerPayment) {
33+func WithdrawLiq (UnstakedAmount) = {
34+ let UserLiquidity = (toBase58String(i.caller.bytes) + "_Liq")
35+ let LastUnstakeBlock = (toBase58String(i.caller.bytes) + "_LastUnstake")
36+ let trxUnstakeNum = (toBase58String(i.caller.bytes) + "_trxUnstake")
37+ let dAppFrees = Address(dAppFees)
38+ let WaitTime = 10
39+ let FeePaid = 1
40+ let amount = match getInteger(this, UserLiquidity) {
8741 case a: Int =>
8842 a
8943 case _ =>
9044 0
9145 }
92- let PaidtrxLast = match getInteger(this, Paidtrx) {
46+ let trxUnstakeValue = match getInteger(this, trxUnstakeNum) {
9347 case a: Int =>
9448 a
9549 case _ =>
9650 0
9751 }
98- let FreelancerAddressStr = getStringValue(this, FreelancerAddress)
99- let PaymentAssetId = getStringValue(this, PaymentAsset)
100- let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr)
101- let dAppFrees = Address(dAppFees)
102- let AssetUsed = if ((PaymentAssetId == "Waves"))
103- then unit
104- else fromBase58String(PaymentAssetId)
105- if ((0 >= (((95 * amount) / 100) - (PayFreelancer * 100000000))))
106- then throw(("You do not have enough funds to make payment, your available funds are: " + toString((amount / 100000000))))
107- else if (if ((PaidtrxLast >= 12))
108- then (amount > 0)
52+ let LastUnstakeBlockValue = match getInteger(this, LastUnstakeBlock) {
53+ case a: Int =>
54+ a
55+ case _ =>
56+ 0
57+ }
58+ let UserBalance = (amount - (UnstakedAmount * 10000000))
59+ if ((0 >= UserBalance))
60+ then throw(("You do not have enough funds to withdraw, your available funds are: " + toString((amount / 100000000))))
61+ else if (if ((trxUnstakeValue == 2))
62+ then (height > (trxUnstakeValue + WaitTime))
10963 else false)
110- then throw("You have already done 12 payments, you cannot make more payments")
64+ then throw((("Second withdraw cannot be done before " + toString(((height - WaitTime) - trxUnstakeValue))) + " min"))
11165 else {
112- let UserAccount = if ((PaidtrxLast == 11))
113- then 0
114- else (amount - (PayFreelancer * 100000000))
115- let Payment2Freelance = if ((PaidtrxLast == 11))
116- then ((95 * amount) / 100)
117- else ((95 * PayFreelancer) * 1000000)
118- let FeePaid = if ((PaidtrxLast == 11))
119- then ((5 * amount) / 100)
120- else ((5 * PayFreelancer) * 1000000)
121- let PaidtrxValue = if ((PaidtrxLast == 11))
122- then 0
123- else (PaidtrxLast + 1)
124- $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_Paidtrx"), PaidtrxValue), ScriptTransfer(AddressFreeLancer, Payment2Freelance, AssetUsed), ScriptTransfer(dAppFrees, FeePaid, AssetUsed)], AssetUsed)
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)
12568 }
12669 }
127-
128-
129-
130-@Callable(i)
131-func AdminTransfer (User,Freelancer,ToFreelancer,ToUser,AdminFee) = if ((i.caller.bytes != AdmindApp))
132- then throw("Only Admin can do this")
133- else if ((((ToUser + ToFreelancer) + AdminFee) != 100))
134- then throw("Total of Percentages cannot be different from 100%")
135- else {
136- let FreeLancerPayment = (User + "_Payment")
137- let FreelancerAddress = (User + "_Freelancer")
138- let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset")
139- let amount = match getInteger(this, FreeLancerPayment) {
140- case a: Int =>
141- a
142- case _ =>
143- 0
144- }
145- let FreelancerAddressStr = getStringValue(this, FreelancerAddress)
146- let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr)
147- let PaymentAssetId = getStringValue(this, PaymentAsset)
148- let dAppFrees = Address(dAppFees)
149- let AddressUser = addressFromStringValue(User)
150- let AssetUsed = if ((PaymentAssetId == "Waves"))
151- then unit
152- else fromBase58String(PaymentAssetId)
153- if ((amount == 0))
154- then throw("User's balance is 0 BUsdc cannot realize any payment")
155- else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * amount) / 100), AssetUsed), ScriptTransfer(AddressUser, ((ToUser * amount) / 100), AssetUsed), ScriptTransfer(dAppFrees, ((AdminFee * amount) / 100), AssetUsed)], AssetUsed)
156- }
15770
15871

github/deemru/w8io/169f3d6 
50.82 ms