tx · BDAQ6YPipKd5NqK7orBhz4A3rHAEB4nKY5eYTPyb1fRm 3NCLRHPm5VYMStKzvP2kkc5mxGSH9wtWAtK: -0.01000000 Waves 2022.05.25 18:03 [2067355] smart account 3NCLRHPm5VYMStKzvP2kkc5mxGSH9wtWAtK > SELF 0.00000000 Waves
{ "type": 13, "id": "BDAQ6YPipKd5NqK7orBhz4A3rHAEB4nKY5eYTPyb1fRm", "fee": 1000000, "feeAssetId": null, "timestamp": 1653491018745, "version": 2, "chainId": 84, "sender": "3NCLRHPm5VYMStKzvP2kkc5mxGSH9wtWAtK", "senderPublicKey": "2bV4VobJC5a6L6e7or9PFXQhQ1KtkZW1UYzjAvMzs6A8", "proofs": [ "4EyGCjdXmyHA7CspchvSJBcLRptrEEkN9MrzMXhQhT77eFLDPfqTHdqTUWrkpbzXPxcMTRKGFRXBKm3nHNdzuvWS" ], "script": "base64:AAIFAAAAAAAAABkIAhIAEgUKAwgICBIDCgEBEgcKBQgIAQEBAAAACwAAAAAEQlVzZAEAAAAgl0pBq34KfUugAqFVxnXIAChne47NFwAe2d/wiUR5CAEAAAAABFVTRFQBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHtnf8IlEeQgBAAAAAARVU0RDAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0XAB7Z3/CJRHkIAQAAAAADQlRDAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0XAB7Z3/CJRHkIAQAAAAADRVRIAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0XAB7Z3/CJRHkIAQAAAAADQk5CAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0XAB7Z3/CJRHkIAQAAAAAEVVNETgEAAAAgl0pBq34KfUugAqFVxnXIAChne47NFwAe2d/wiUR5CAEAAAAABEhBU0gBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHtnf8IlEeQgBAAAAAARLVVNEAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0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AAAAAAAAZAUAAAAJQXNzZXRVc2VkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAC0FkZHJlc3NVc2VyCQAAaQAAAAIJAABoAAAAAgUAAAAGVG9Vc2VyBQAAAAZhbW91bnQAAAAAAAAAAGQFAAAACUFzc2V0VXNlZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAlkQXBwRnJlZXMJAABpAAAAAgkAAGgAAAACBQAAAAhBZG1pbkZlZQUAAAAGYW1vdW50AAAAAAAAAABkBQAAAAlBc3NldFVzZWQFAAAAA25pbAUAAAAJQXNzZXRVc2VkAAAAAFbMPX8=", "height": 2067355, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DjR6GxTsN1sWxnpFzBg4ns7bZTzAzedXWgQdxAuRjTtG Next: 6xL2s9q3MjmTvErTFRHvR3sx3bCi13BtoXgGu7Y8fxZW Diff:
Old | New | Differences | |
---|---|---|---|
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | - | func AdminTransfer (User,Freelancer,ToFreelancer) = if ((i.caller.bytes != AdmindApp)) | |
134 | + | func AdminTransfer (User,Freelancer,ToFreelancer,ToUser,AdminFee) = if ((i.caller.bytes != AdmindApp)) | |
135 | 135 | then throw("Only Admin can do this") | |
136 | - | else { | |
137 | - | let FreeLancerPayment = (User + "_Payment") | |
138 | - | let FreelancerAddress = (User + "_Freelancer") | |
139 | - | let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset") | |
140 | - | let amount = match getInteger(this, FreeLancerPayment) { | |
141 | - | case a: Int => | |
142 | - | a | |
143 | - | case _ => | |
144 | - | 0 | |
145 | - | } | |
146 | - | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
147 | - | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
148 | - | let PaymentAssetId = getStringValue(this, PaymentAsset) | |
149 | - | let dAppFrees = Address(dAppFees) | |
150 | - | let AddressUser = addressFromStringValue(User) | |
151 | - | let AssetUsed = if ((PaymentAssetId == "Waves")) | |
152 | - | then unit | |
153 | - | else fromBase58String(PaymentAssetId) | |
154 | - | if ((amount == 0)) | |
155 | - | then throw("User's balance is 0 BUsdc cannot realize any payment") | |
156 | - | else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * (95 * amount)) / 10000), AssetUsed), ScriptTransfer(AddressUser, (((100 - ToFreelancer) * (95 * amount)) / 10000), AssetUsed), ScriptTransfer(dAppFrees, ((5 * amount) / 100), AssetUsed)], AssetUsed) | |
157 | - | } | |
136 | + | else if ((((ToUser + ToFreelancer) + AdminFee) != 100)) | |
137 | + | then throw("Total of Percentages cannot be different from 100%") | |
138 | + | else { | |
139 | + | let FreeLancerPayment = (User + "_Payment") | |
140 | + | let FreelancerAddress = (User + "_Freelancer") | |
141 | + | let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset") | |
142 | + | let amount = match getInteger(this, FreeLancerPayment) { | |
143 | + | case a: Int => | |
144 | + | a | |
145 | + | case _ => | |
146 | + | 0 | |
147 | + | } | |
148 | + | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
149 | + | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
150 | + | let PaymentAssetId = getStringValue(this, PaymentAsset) | |
151 | + | let dAppFrees = Address(dAppFees) | |
152 | + | let AddressUser = addressFromStringValue(User) | |
153 | + | let AssetUsed = if ((PaymentAssetId == "Waves")) | |
154 | + | then unit | |
155 | + | else fromBase58String(PaymentAssetId) | |
156 | + | if ((amount == 0)) | |
157 | + | then throw("User's balance is 0 BUsdc cannot realize any payment") | |
158 | + | 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) | |
159 | + | } | |
158 | 160 | ||
159 | 161 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BUsd = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
5 | 5 | ||
6 | 6 | let USDT = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
7 | 7 | ||
8 | 8 | let USDC = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
9 | 9 | ||
10 | 10 | let BTC = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
11 | 11 | ||
12 | 12 | let ETH = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
13 | 13 | ||
14 | 14 | let BNB = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
15 | 15 | ||
16 | 16 | let USDN = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
17 | 17 | ||
18 | 18 | let HASH = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
19 | 19 | ||
20 | 20 | let KUSD = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
21 | 21 | ||
22 | 22 | let dAppFees = base58'3N9Lfz79kZAEUupwESSboYFyygo1nQguVXo' | |
23 | 23 | ||
24 | 24 | let AdmindApp = base58'3Mx3pn4yMcBccM59UrDGjbbAkVsRYBw38tB' | |
25 | 25 | ||
26 | 26 | @Callable(i) | |
27 | 27 | func Reset () = [IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), 0), IntegerEntry((toBase58String(i.caller.bytes) + "_Paidtrx"), 0)] | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | 31 | @Callable(i) | |
32 | 32 | func DepositFunds (ScopeDesc,Deliverables,FreelancerAddress) = { | |
33 | 33 | let FreeLancerPayment = (toBase58String(i.caller.bytes) + "_Payment") | |
34 | 34 | let amount = match getInteger(this, FreeLancerPayment) { | |
35 | 35 | case a: Int => | |
36 | 36 | a | |
37 | 37 | case _ => | |
38 | 38 | 0 | |
39 | 39 | } | |
40 | 40 | if ((amount != 0)) | |
41 | 41 | then throw("You have already deposited funds, deposits can only be done once") | |
42 | 42 | else { | |
43 | 43 | let pmt = if ((size(i.payments) == 1)) | |
44 | 44 | then i.payments[0] | |
45 | 45 | else throw("Attached payment is required") | |
46 | 46 | if (if (if (if (if (if (if (if (if (if ((pmt.assetId != BUsd)) | |
47 | 47 | then (pmt.assetId != USDT) | |
48 | 48 | else false) | |
49 | 49 | then (pmt.assetId != USDC) | |
50 | 50 | else false) | |
51 | 51 | then (pmt.assetId != BTC) | |
52 | 52 | else false) | |
53 | 53 | then (pmt.assetId != ETH) | |
54 | 54 | else false) | |
55 | 55 | then (pmt.assetId != BNB) | |
56 | 56 | else false) | |
57 | 57 | then (pmt.assetId != USDN) | |
58 | 58 | else false) | |
59 | 59 | then (pmt.assetId != HASH) | |
60 | 60 | else false) | |
61 | 61 | then (pmt.assetId != KUSD) | |
62 | 62 | else false) | |
63 | 63 | then isDefined(pmt.assetId) | |
64 | 64 | else false) | |
65 | 65 | then throw("Can only deposit accepted tokens") | |
66 | 66 | else if (if (if ((ScopeDesc == "")) | |
67 | 67 | then true | |
68 | 68 | else (Deliverables == "")) | |
69 | 69 | then true | |
70 | 70 | else (FreelancerAddress == "")) | |
71 | 71 | then throw("Job Scope, Deliverables desc and Freelancer Wallet Address cannot be empty") | |
72 | 72 | else { | |
73 | 73 | let AssetUsed = if (isDefined(pmt.assetId)) | |
74 | 74 | then toBase58String(value(pmt.assetId)) | |
75 | 75 | else "Waves" | |
76 | 76 | [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)] | |
77 | 77 | } | |
78 | 78 | } | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | ||
83 | 83 | @Callable(i) | |
84 | 84 | func PayFreelancer (PayFreelancer) = { | |
85 | 85 | let FreeLancerPayment = (toBase58String(i.caller.bytes) + "_Payment") | |
86 | 86 | let FreelancerAddress = (toBase58String(i.caller.bytes) + "_Freelancer") | |
87 | 87 | let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset") | |
88 | 88 | let Paidtrx = (toBase58String(i.caller.bytes) + "_Paidtrx") | |
89 | 89 | let amount = match getInteger(this, FreeLancerPayment) { | |
90 | 90 | case a: Int => | |
91 | 91 | a | |
92 | 92 | case _ => | |
93 | 93 | 0 | |
94 | 94 | } | |
95 | 95 | let PaidtrxLast = match getInteger(this, Paidtrx) { | |
96 | 96 | case a: Int => | |
97 | 97 | a | |
98 | 98 | case _ => | |
99 | 99 | 0 | |
100 | 100 | } | |
101 | 101 | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
102 | 102 | let PaymentAssetId = getStringValue(this, PaymentAsset) | |
103 | 103 | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
104 | 104 | let dAppFrees = Address(dAppFees) | |
105 | 105 | let AssetUsed = if ((PaymentAssetId == "Waves")) | |
106 | 106 | then unit | |
107 | 107 | else fromBase58String(PaymentAssetId) | |
108 | 108 | if ((0 >= (((95 * amount) / 100) - (PayFreelancer * 100000000)))) | |
109 | 109 | then throw(("You do not have enough funds to make payment, your available funds are: " + toString((amount / 100000000)))) | |
110 | 110 | else if (if ((PaidtrxLast >= 12)) | |
111 | 111 | then (amount > 0) | |
112 | 112 | else false) | |
113 | 113 | then throw("You have already done 12 payments, you cannot make more payments") | |
114 | 114 | else { | |
115 | 115 | let UserAccount = if ((PaidtrxLast == 11)) | |
116 | 116 | then 0 | |
117 | 117 | else (amount - (PayFreelancer * 100000000)) | |
118 | 118 | let Payment2Freelance = if ((PaidtrxLast == 11)) | |
119 | 119 | then ((95 * amount) / 100) | |
120 | 120 | else ((95 * PayFreelancer) * 1000000) | |
121 | 121 | let FeePaid = if ((PaidtrxLast == 11)) | |
122 | 122 | then ((5 * amount) / 100) | |
123 | 123 | else ((5 * PayFreelancer) * 1000000) | |
124 | 124 | let PaidtrxValue = if ((PaidtrxLast == 11)) | |
125 | 125 | then 0 | |
126 | 126 | else (PaidtrxLast + 1) | |
127 | 127 | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), UserAccount), IntegerEntry((toBase58String(i.caller.bytes) + "_Paidtrx"), PaidtrxValue), ScriptTransfer(AddressFreeLancer, Payment2Freelance, AssetUsed), ScriptTransfer(dAppFrees, FeePaid, AssetUsed)], AssetUsed) | |
128 | 128 | } | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | - | func AdminTransfer (User,Freelancer,ToFreelancer) = if ((i.caller.bytes != AdmindApp)) | |
134 | + | func AdminTransfer (User,Freelancer,ToFreelancer,ToUser,AdminFee) = if ((i.caller.bytes != AdmindApp)) | |
135 | 135 | then throw("Only Admin can do this") | |
136 | - | else { | |
137 | - | let FreeLancerPayment = (User + "_Payment") | |
138 | - | let FreelancerAddress = (User + "_Freelancer") | |
139 | - | let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset") | |
140 | - | let amount = match getInteger(this, FreeLancerPayment) { | |
141 | - | case a: Int => | |
142 | - | a | |
143 | - | case _ => | |
144 | - | 0 | |
145 | - | } | |
146 | - | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
147 | - | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
148 | - | let PaymentAssetId = getStringValue(this, PaymentAsset) | |
149 | - | let dAppFrees = Address(dAppFees) | |
150 | - | let AddressUser = addressFromStringValue(User) | |
151 | - | let AssetUsed = if ((PaymentAssetId == "Waves")) | |
152 | - | then unit | |
153 | - | else fromBase58String(PaymentAssetId) | |
154 | - | if ((amount == 0)) | |
155 | - | then throw("User's balance is 0 BUsdc cannot realize any payment") | |
156 | - | else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * (95 * amount)) / 10000), AssetUsed), ScriptTransfer(AddressUser, (((100 - ToFreelancer) * (95 * amount)) / 10000), AssetUsed), ScriptTransfer(dAppFrees, ((5 * amount) / 100), AssetUsed)], AssetUsed) | |
157 | - | } | |
136 | + | else if ((((ToUser + ToFreelancer) + AdminFee) != 100)) | |
137 | + | then throw("Total of Percentages cannot be different from 100%") | |
138 | + | else { | |
139 | + | let FreeLancerPayment = (User + "_Payment") | |
140 | + | let FreelancerAddress = (User + "_Freelancer") | |
141 | + | let PaymentAsset = (toBase58String(i.caller.bytes) + "_Asset") | |
142 | + | let amount = match getInteger(this, FreeLancerPayment) { | |
143 | + | case a: Int => | |
144 | + | a | |
145 | + | case _ => | |
146 | + | 0 | |
147 | + | } | |
148 | + | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
149 | + | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
150 | + | let PaymentAssetId = getStringValue(this, PaymentAsset) | |
151 | + | let dAppFrees = Address(dAppFees) | |
152 | + | let AddressUser = addressFromStringValue(User) | |
153 | + | let AssetUsed = if ((PaymentAssetId == "Waves")) | |
154 | + | then unit | |
155 | + | else fromBase58String(PaymentAssetId) | |
156 | + | if ((amount == 0)) | |
157 | + | then throw("User's balance is 0 BUsdc cannot realize any payment") | |
158 | + | 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) | |
159 | + | } | |
158 | 160 | ||
159 | 161 |
github/deemru/w8io/026f985 39.28 ms ◑