tx · ACL7zfMx1Rt4jE3KTg78Ka7DnuLv8fCsKn945aduttiK 3NCLRHPm5VYMStKzvP2kkc5mxGSH9wtWAtK: -0.01000000 Waves 2022.05.23 18:28 [2064509] smart account 3NCLRHPm5VYMStKzvP2kkc5mxGSH9wtWAtK > SELF 0.00000000 Waves
{ "type": 13, "id": "ACL7zfMx1Rt4jE3KTg78Ka7DnuLv8fCsKn945aduttiK", "fee": 1000000, "feeAssetId": null, "timestamp": 1653319737766, "version": 2, "chainId": 84, "sender": "3NCLRHPm5VYMStKzvP2kkc5mxGSH9wtWAtK", "senderPublicKey": "2bV4VobJC5a6L6e7or9PFXQhQ1KtkZW1UYzjAvMzs6A8", "proofs": [ "5PrkEJmUENf1x98S4WdPUmCLt18TcAksxucK7cGkC1X5UfkSUW1uptykMuPoQXL9BqNpsJ5GBFjiVsTxQCWFsx4E" ], "script": "base64:AAIFAAAAAAAAABUIAhIFCgMICAgSAwoBARIFCgMICAEAAAALAAAAAARCVXNkAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0XAB7Z3/CJRHkIAQAAAAAEVVNEVAEAAAAgl0pBq34KfUugAqFVxnXIAChne47NFwAe2d/wiUR5CAEAAAAABFVTREMBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHtnf8IlEeQgBAAAAAANCVEMBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHtnf8IlEeQgBAAAAAANFVEgBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHtnf8IlEeQgBAAAAAANCTkIBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHtnf8IlEeQgBAAAAAARVU0ROAQAAACCXSkGrfgp9S6ACoVXGdcgAKGd7js0XAB7Z3/CJRHkIAQAAAAAESEFTSAEAAAAgl0pBq34KfUugAqFVxnXIAChne47NFwAe2d/wiUR5CAEAAAAABEtVU0QBAAAAIJdKQat+Cn1LoAKhVcZ1yAAoZ3uOzRcAHt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hbmNlcgkAAGgAAAACAAAAAAAAAABfBQAAAAZhbW91bnQAAAAAAAAAJxAFAAAABEJVc2QJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAJZEFwcEZyZWVzCQAAaQAAAAIJAABoAAAAAgAAAAAAAAAABQUAAAAGYW1vdW50AAAAAAAAAABkBQAAAARCVXNkBQAAAANuaWwFAAAABEJVc2QAAAAA/QNRZg==", "height": 2064509, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HEpVmocfZCTauc2XaS3QM5yE6oxffu49s5P7LmjwjMgm Next: D64mwGZYvsCec1pJY3aMMGbmCqa93Af9hHYfp1L2UDoj Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BUsd = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
5 | + | ||
6 | + | let USDT = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
7 | + | ||
8 | + | let USDC = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
9 | + | ||
10 | + | let BTC = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
11 | + | ||
12 | + | let ETH = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
13 | + | ||
14 | + | let BNB = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
15 | + | ||
16 | + | let USDN = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
17 | + | ||
18 | + | let HASH = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
19 | + | ||
20 | + | let KUSD = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
5 | 21 | ||
6 | 22 | let dAppFees = base58'3N9Lfz79kZAEUupwESSboYFyygo1nQguVXo' | |
7 | 23 | ||
12 | 28 | let pmt = if ((size(i.payments) == 1)) | |
13 | 29 | then i.payments[0] | |
14 | 30 | else throw("Attached payment is required") | |
15 | - | if (if (if ((ScopeDesc == "")) | |
16 | - | then true | |
17 | - | else (Deliverables == "")) | |
18 | - | then true | |
19 | - | else (FreelancerAddress == "")) | |
20 | - | then throw("Job Scope, Deliverables desc and Freelancer Wallet Address cannot be empty") | |
21 | - | else [StringEntry((toBase58String(i.caller.bytes) + "_Scope"), ScopeDesc), StringEntry((toBase58String(i.caller.bytes) + "_Deliv"), Deliverables), StringEntry((toBase58String(i.caller.bytes) + "_Freelancer"), FreelancerAddress), IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), pmt.amount)] | |
31 | + | if (if (if (if (if (if (if (if (if (if ((pmt.assetId != BUsd)) | |
32 | + | then (pmt.assetId != USDT) | |
33 | + | else false) | |
34 | + | then (pmt.assetId != USDC) | |
35 | + | else false) | |
36 | + | then (pmt.assetId != BTC) | |
37 | + | else false) | |
38 | + | then (pmt.assetId != ETH) | |
39 | + | else false) | |
40 | + | then (pmt.assetId != BNB) | |
41 | + | else false) | |
42 | + | then (pmt.assetId != USDN) | |
43 | + | else false) | |
44 | + | then (pmt.assetId != HASH) | |
45 | + | else false) | |
46 | + | then (pmt.assetId != KUSD) | |
47 | + | else false) | |
48 | + | then isDefined(pmt.assetId) | |
49 | + | else false) | |
50 | + | then if (if (if ((ScopeDesc == "")) | |
51 | + | then true | |
52 | + | else (Deliverables == "")) | |
53 | + | then true | |
54 | + | else (FreelancerAddress == "")) | |
55 | + | then throw("Job Scope, Deliverables desc and Freelancer Wallet Address cannot be empty") | |
56 | + | else [StringEntry((toBase58String(i.caller.bytes) + "_Scope"), ScopeDesc), StringEntry((toBase58String(i.caller.bytes) + "_Deliv"), Deliverables), StringEntry((toBase58String(i.caller.bytes) + "_Freelancer"), FreelancerAddress), IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), pmt.amount)] | |
57 | + | else throw("Can only deposit accepted tokens") | |
22 | 58 | } | |
23 | 59 | ||
24 | 60 | ||
25 | 61 | ||
26 | 62 | @Callable(i) | |
27 | - | func PayFreelancer () = { | |
63 | + | func PayFreelancer (PayFreelancer) = { | |
28 | 64 | let FreeLancerPayment = (toBase58String(i.caller.bytes) + "_Payment") | |
29 | 65 | let FreelancerAddress = (toBase58String(i.caller.bytes) + "_Freelancer") | |
66 | + | let Paidtrx = (toBase58String(i.caller.bytes) + "_Paidtrx") | |
30 | 67 | let amount = match getInteger(this, FreeLancerPayment) { | |
31 | 68 | case a: Int => | |
32 | 69 | a | |
33 | 70 | case _ => | |
34 | 71 | 0 | |
35 | 72 | } | |
73 | + | let PaidtrxValue = match getInteger(this, Paidtrx) { | |
74 | + | case a: Int => | |
75 | + | a | |
76 | + | case _ => | |
77 | + | 0 | |
78 | + | } | |
79 | + | let NewPaidtrxValue = (PaidtrxValue + 1) | |
36 | 80 | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
37 | 81 | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
38 | 82 | let dAppFrees = Address(dAppFees) | |
39 | - | if ((amount == 0)) | |
40 | - | then throw("Your balance is 0 BUsdc cannot realize any payment") | |
41 | - | else $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((95 * amount) / 100), BUsd), ScriptTransfer(dAppFrees, ((5 * amount) / 100), BUsd)], BUsd) | |
83 | + | if ((0 >= (amount - PayFreelancer))) | |
84 | + | then throw(("You do not have enough funds to make payment, your available funds are: " + toString((amount / 100000000)))) | |
85 | + | else if ((NewPaidtrxValue > 12)) | |
86 | + | then throw("You have already done 12 payments, you cannot make more payments") | |
87 | + | else { | |
88 | + | let Payment2Freelance = if ((NewPaidtrxValue == 12)) | |
89 | + | then amount | |
90 | + | else (amount - PayFreelancer) | |
91 | + | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), Payment2Freelance), IntegerEntry((toBase58String(i.caller.bytes) + "_Paidtrx"), NewPaidtrxValue), ScriptTransfer(AddressFreeLancer, ((95 * amount) / 100), BUsd), ScriptTransfer(dAppFrees, ((5 * amount) / 100), BUsd)], BUsd) | |
92 | + | } | |
42 | 93 | } | |
43 | 94 | ||
44 | 95 | ||
45 | 96 | ||
46 | 97 | @Callable(i) | |
47 | - | func AdminTransfer (User,Freelancer | |
98 | + | func AdminTransfer (User,Freelancer,ToFreelancer) = if ((i.caller.bytes != AdmindApp)) | |
48 | 99 | then throw("Only Admin can do this") | |
49 | 100 | else { | |
50 | 101 | let FreeLancerPayment = (User + "_Payment") | |
61 | 112 | let AddressUser = addressFromStringValue(User) | |
62 | 113 | if ((amount == 0)) | |
63 | 114 | then throw("User's balance is 0 BUsdc cannot realize any payment") | |
64 | - | else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * (95 * amount)) / 10000), BUsd), ScriptTransfer(AddressUser, (( | |
115 | + | else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * (95 * amount)) / 10000), BUsd), ScriptTransfer(AddressUser, (((100 - ToFreelancer) * (95 * amount)) / 10000), BUsd), ScriptTransfer(dAppFrees, ((5 * amount) / 100), BUsd)], BUsd) | |
65 | 116 | } | |
66 | 117 | ||
67 | 118 |
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 | + | ||
6 | + | let USDT = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
7 | + | ||
8 | + | let USDC = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
9 | + | ||
10 | + | let BTC = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
11 | + | ||
12 | + | let ETH = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
13 | + | ||
14 | + | let BNB = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
15 | + | ||
16 | + | let USDN = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
17 | + | ||
18 | + | let HASH = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
19 | + | ||
20 | + | let KUSD = base58'BBaEeEmuA6qPNowGcB8BXozC2PmAAG48G5zzSWw8qt2k' | |
5 | 21 | ||
6 | 22 | let dAppFees = base58'3N9Lfz79kZAEUupwESSboYFyygo1nQguVXo' | |
7 | 23 | ||
8 | 24 | let AdmindApp = base58'3Mx3pn4yMcBccM59UrDGjbbAkVsRYBw38tB' | |
9 | 25 | ||
10 | 26 | @Callable(i) | |
11 | 27 | func DepositFunds (ScopeDesc,Deliverables,FreelancerAddress) = { | |
12 | 28 | let pmt = if ((size(i.payments) == 1)) | |
13 | 29 | then i.payments[0] | |
14 | 30 | else throw("Attached payment is required") | |
15 | - | if (if (if ((ScopeDesc == "")) | |
16 | - | then true | |
17 | - | else (Deliverables == "")) | |
18 | - | then true | |
19 | - | else (FreelancerAddress == "")) | |
20 | - | then throw("Job Scope, Deliverables desc and Freelancer Wallet Address cannot be empty") | |
21 | - | else [StringEntry((toBase58String(i.caller.bytes) + "_Scope"), ScopeDesc), StringEntry((toBase58String(i.caller.bytes) + "_Deliv"), Deliverables), StringEntry((toBase58String(i.caller.bytes) + "_Freelancer"), FreelancerAddress), IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), pmt.amount)] | |
31 | + | if (if (if (if (if (if (if (if (if (if ((pmt.assetId != BUsd)) | |
32 | + | then (pmt.assetId != USDT) | |
33 | + | else false) | |
34 | + | then (pmt.assetId != USDC) | |
35 | + | else false) | |
36 | + | then (pmt.assetId != BTC) | |
37 | + | else false) | |
38 | + | then (pmt.assetId != ETH) | |
39 | + | else false) | |
40 | + | then (pmt.assetId != BNB) | |
41 | + | else false) | |
42 | + | then (pmt.assetId != USDN) | |
43 | + | else false) | |
44 | + | then (pmt.assetId != HASH) | |
45 | + | else false) | |
46 | + | then (pmt.assetId != KUSD) | |
47 | + | else false) | |
48 | + | then isDefined(pmt.assetId) | |
49 | + | else false) | |
50 | + | then if (if (if ((ScopeDesc == "")) | |
51 | + | then true | |
52 | + | else (Deliverables == "")) | |
53 | + | then true | |
54 | + | else (FreelancerAddress == "")) | |
55 | + | then throw("Job Scope, Deliverables desc and Freelancer Wallet Address cannot be empty") | |
56 | + | else [StringEntry((toBase58String(i.caller.bytes) + "_Scope"), ScopeDesc), StringEntry((toBase58String(i.caller.bytes) + "_Deliv"), Deliverables), StringEntry((toBase58String(i.caller.bytes) + "_Freelancer"), FreelancerAddress), IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), pmt.amount)] | |
57 | + | else throw("Can only deposit accepted tokens") | |
22 | 58 | } | |
23 | 59 | ||
24 | 60 | ||
25 | 61 | ||
26 | 62 | @Callable(i) | |
27 | - | func PayFreelancer () = { | |
63 | + | func PayFreelancer (PayFreelancer) = { | |
28 | 64 | let FreeLancerPayment = (toBase58String(i.caller.bytes) + "_Payment") | |
29 | 65 | let FreelancerAddress = (toBase58String(i.caller.bytes) + "_Freelancer") | |
66 | + | let Paidtrx = (toBase58String(i.caller.bytes) + "_Paidtrx") | |
30 | 67 | let amount = match getInteger(this, FreeLancerPayment) { | |
31 | 68 | case a: Int => | |
32 | 69 | a | |
33 | 70 | case _ => | |
34 | 71 | 0 | |
35 | 72 | } | |
73 | + | let PaidtrxValue = match getInteger(this, Paidtrx) { | |
74 | + | case a: Int => | |
75 | + | a | |
76 | + | case _ => | |
77 | + | 0 | |
78 | + | } | |
79 | + | let NewPaidtrxValue = (PaidtrxValue + 1) | |
36 | 80 | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
37 | 81 | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
38 | 82 | let dAppFrees = Address(dAppFees) | |
39 | - | if ((amount == 0)) | |
40 | - | then throw("Your balance is 0 BUsdc cannot realize any payment") | |
41 | - | else $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((95 * amount) / 100), BUsd), ScriptTransfer(dAppFrees, ((5 * amount) / 100), BUsd)], BUsd) | |
83 | + | if ((0 >= (amount - PayFreelancer))) | |
84 | + | then throw(("You do not have enough funds to make payment, your available funds are: " + toString((amount / 100000000)))) | |
85 | + | else if ((NewPaidtrxValue > 12)) | |
86 | + | then throw("You have already done 12 payments, you cannot make more payments") | |
87 | + | else { | |
88 | + | let Payment2Freelance = if ((NewPaidtrxValue == 12)) | |
89 | + | then amount | |
90 | + | else (amount - PayFreelancer) | |
91 | + | $Tuple2([IntegerEntry((toBase58String(i.caller.bytes) + "_Payment"), Payment2Freelance), IntegerEntry((toBase58String(i.caller.bytes) + "_Paidtrx"), NewPaidtrxValue), ScriptTransfer(AddressFreeLancer, ((95 * amount) / 100), BUsd), ScriptTransfer(dAppFrees, ((5 * amount) / 100), BUsd)], BUsd) | |
92 | + | } | |
42 | 93 | } | |
43 | 94 | ||
44 | 95 | ||
45 | 96 | ||
46 | 97 | @Callable(i) | |
47 | - | func AdminTransfer (User,Freelancer | |
98 | + | func AdminTransfer (User,Freelancer,ToFreelancer) = if ((i.caller.bytes != AdmindApp)) | |
48 | 99 | then throw("Only Admin can do this") | |
49 | 100 | else { | |
50 | 101 | let FreeLancerPayment = (User + "_Payment") | |
51 | 102 | let FreelancerAddress = (User + "_Freelancer") | |
52 | 103 | let amount = match getInteger(this, FreeLancerPayment) { | |
53 | 104 | case a: Int => | |
54 | 105 | a | |
55 | 106 | case _ => | |
56 | 107 | 0 | |
57 | 108 | } | |
58 | 109 | let FreelancerAddressStr = getStringValue(this, FreelancerAddress) | |
59 | 110 | let AddressFreeLancer = addressFromStringValue(FreelancerAddressStr) | |
60 | 111 | let dAppFrees = Address(dAppFees) | |
61 | 112 | let AddressUser = addressFromStringValue(User) | |
62 | 113 | if ((amount == 0)) | |
63 | 114 | then throw("User's balance is 0 BUsdc cannot realize any payment") | |
64 | - | else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * (95 * amount)) / 10000), BUsd), ScriptTransfer(AddressUser, (( | |
115 | + | else $Tuple2([IntegerEntry((User + "_Payment"), 0), ScriptTransfer(AddressFreeLancer, ((ToFreelancer * (95 * amount)) / 10000), BUsd), ScriptTransfer(AddressUser, (((100 - ToFreelancer) * (95 * amount)) / 10000), BUsd), ScriptTransfer(dAppFrees, ((5 * amount) / 100), BUsd)], BUsd) | |
65 | 116 | } | |
66 | 117 | ||
67 | 118 |
github/deemru/w8io/169f3d6 52.98 ms ◑