tx · ChzzcunKXKFBUAqWb6esU6f9b1feFf1hwpiaB3ZoNWwi 3MrqA2Y4YoRFMxi9docdZqyj9dkoe4G2S2h: -0.05000000 Waves 2024.01.15 17:34 [2932772] smart account 3MrqA2Y4YoRFMxi9docdZqyj9dkoe4G2S2h > SELF 0.00000000 Waves
{ "type": 13, "id": "ChzzcunKXKFBUAqWb6esU6f9b1feFf1hwpiaB3ZoNWwi", "fee": 5000000, "feeAssetId": null, "timestamp": 1705329302573, "version": 2, "chainId": 84, "sender": "3MrqA2Y4YoRFMxi9docdZqyj9dkoe4G2S2h", "senderPublicKey": "4mNzRJgnxrEBwYEU7AhvgkwwUuXN37BwBy8hxoyGuRvA", "proofs": [ "2LkTNpGnSLjCnHFPf63pkrXjr946kRBGERvYKCumpFw8suXWHAhZKP1JHi473HvDHdo1nkKXRzoZhwDfh6YhV92u" ], "script": "base64:BgIWCAISBgoEGBERCBIAEgMKAQESAwoBAQcAFHVzZXJfYmFsYW5jZV9hZGRyZXNzAiMzTjFzMnc0TkhnYnJYeE5aWEg5UnRhVlQ5cHRIUkpjZ1NwMgARbHBfYWRkcmVzc19wdWJrZXkBIMjtmNqG7lU1WGDHPJboKlti9SIwxR/k7IFRCWjnzhpzACBtYXNzdHJhbnNmZXJfd2hpdGVsaXN0ZWRfYWRkcmVzcwkApwgBBRFscF9hZGRyZXNzX3B1YmtleQAUbHBfZGVwb3NpdG9yX2FkZHJlc3MBIAKzAejCIyo1u64LRV3TLFVU23AoEuHL2Ni8HYSbNWZ5ABRscF93aGl0ZWxpc3RfYWRkcmVzcwkApwgBBRRscF9kZXBvc2l0b3JfYWRkcmVzcwALbmV0d29ya19mZWUAoMIeAR12YWxpZGF0ZU1hc3NUcmFuc2ZlckFyZ3VtZW50cwQKcmVjaXBpZW50cwdhbW91bnRzCnBheW1lbnRJZHgIcGF5bWVudHMEDnJlY2lwaWVudHNTaXplCQCQAwEFCnJlY2lwaWVudHMEC2Ftb3VudHNTaXplCQCQAwEFB2Ftb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gUG9vbCBMaXF1aWRpdHkuCQDMCAIJAQxJbnRlZ2VyRW50cnkCAhRUb3RhbF9Qb29sX0xpcXVpZGl0eQUUdXBkYXRlZF9wb29sX2JhbGFuY2UJAMwIAgkBDEludGVnZXJFbnRyeQICE0xQX1dpdGhkcmF3X0NvdW50ZXIFFlRvdGFsTFBXaXRoZHJhd0NvdW50ZXIJAMwIAgkBDEludGVnZXJFbnRyeQICEVRvdGFsX0xQX1dpdGhkcmF3BQ9Ub3RhbExQV2l0aGRyYXcJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkApAMBBRZUb3RhbExQV2l0aGRyYXdDb3VudGVyAgxfTFBfV2l0aGRyYXcFDldpdGhkcmF3QW1vdW50CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMFFGxwX3doaXRlbGlzdF9hZGRyZXNzBQ5XaXRoZHJhd0Ftb3VudAUEdW5pdAUDbmlsAQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAUCdHgDAwkAAQIFByRtYXRjaDACBU9yZGVyBgMJAAECBQckbWF0Y2gwAhNFeGNoYW5nZVRyYW5zYWN0aW9uBgkAAQIFByRtYXRjaDACE1RyYW5zZmVyVHJhbnNhY3Rpb24EAXQFByRtYXRjaDAHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V57h6+Sg==", "height": 2932772, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 62zaBu8LDAWcc45YMBWXe47kMTXdLUYzt46SPs7DqNHC Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let user_balance_address = "3N1s2w4NHgbrXxNZXH9RtaVT9ptHRJcgSp2" | |
5 | 5 | ||
6 | - | let | |
6 | + | let lp_address_pubkey = base58'EXLfxKmqhQPiProBaoPatTentUSZX5Dd8A8bYDcmfNwt' | |
7 | 7 | ||
8 | - | let | |
8 | + | let masstransfer_whitelisted_address = addressFromPublicKey(lp_address_pubkey) | |
9 | 9 | ||
10 | - | let | |
10 | + | let lp_depositor_address = base58'BY8Zzs9J1T1DuiWMW4QKgbVAC99HYARVSxV4gd8fN7A' | |
11 | 11 | ||
12 | - | let | |
12 | + | let lp_whitelist_address = addressFromPublicKey(lp_depositor_address) | |
13 | 13 | ||
14 | - | let | |
14 | + | let network_fee = 500000 | |
15 | 15 | ||
16 | - | let closed_oracle_eror = "Oracle is closed. Wait Until Oracle is Turned On." | |
16 | + | func validateMassTransferArguments (recipients,amounts,paymentIdx,payments) = { | |
17 | + | let recipientsSize = size(recipients) | |
18 | + | let amountsSize = size(amounts) | |
19 | + | let paymentIdxSize = size(paymentIdx) | |
20 | + | let paymentsSize = size(payments) | |
21 | + | let minAmount = min(amounts) | |
22 | + | let minPaymentIdx = min(paymentIdx) | |
23 | + | let maxPaymentIdx = max(paymentIdx) | |
24 | + | func paymentsValidator (paymentAccum,nextPayment) = { | |
25 | + | let $t014481485 = paymentAccum | |
26 | + | let validPayments = $t014481485._1 | |
27 | + | let j = $t014481485._2 | |
28 | + | if ((j >= paymentsSize)) | |
29 | + | then $Tuple2(validPayments, (j + 1)) | |
30 | + | else { | |
31 | + | func amountsAggregator (amountAccum,nextAmount) = { | |
32 | + | let $t016121641 = amountAccum | |
33 | + | let amount = $t016121641._1 | |
34 | + | let k = $t016121641._2 | |
35 | + | if (if ((k >= recipientsSize)) | |
36 | + | then true | |
37 | + | else (paymentIdx[k] != j)) | |
38 | + | then $Tuple2(amount, (k + 1)) | |
39 | + | else $Tuple2((amount + nextAmount), (k + 1)) | |
40 | + | } | |
17 | 41 | ||
18 | - | let whitelist_address = addressFromPublicKey(Dapp_Address_pub_key) | |
42 | + | let aggregatedAmount = { | |
43 | + | let $l = amounts | |
44 | + | let $s = size($l) | |
45 | + | let $acc0 = $Tuple2(0, 0) | |
46 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
47 | + | then $a | |
48 | + | else amountsAggregator($a, $l[$i]) | |
19 | 49 | ||
20 | - | let d2dcaller = addressFromPublicKey(base58'6oay51Q6zPcFP9bSwUC4Potx2KGyD4AUjpL5uLR4QeRN') | |
50 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
51 | + | then $a | |
52 | + | else throw("List size exceeds 100") | |
21 | 53 | ||
22 | - | let network_fee = 900000 | |
54 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
55 | + | } | |
56 | + | if ((aggregatedAmount._1 == nextPayment.amount)) | |
57 | + | then $Tuple2((validPayments + 1), (j + 1)) | |
58 | + | else $Tuple2(validPayments, (j + 1)) | |
59 | + | } | |
60 | + | } | |
23 | 61 | ||
24 | - | let minimum_order_size = 10000000 | |
62 | + | let paymentsValidation = { | |
63 | + | let $l = payments | |
64 | + | let $s = size($l) | |
65 | + | let $acc0 = $Tuple2(0, 0) | |
66 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
67 | + | then $a | |
68 | + | else paymentsValidator($a, $l[$i]) | |
25 | 69 | ||
26 | - | let maximum_order_size = 10000000000 | |
70 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
71 | + | then $a | |
72 | + | else throw("List size exceeds 10") | |
27 | 73 | ||
28 | - | let maximum_voucher_size = 100000000 | |
74 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
75 | + | } | |
76 | + | if (if (if (if (if (if (if (if ((recipientsSize == amountsSize)) | |
77 | + | then (recipientsSize == paymentIdxSize) | |
78 | + | else false) | |
79 | + | then (recipientsSize > 0) | |
80 | + | else false) | |
81 | + | then (100 >= recipientsSize) | |
82 | + | else false) | |
83 | + | then (paymentsSize > 0) | |
84 | + | else false) | |
85 | + | then (minAmount > 0) | |
86 | + | else false) | |
87 | + | then (minPaymentIdx == 0) | |
88 | + | else false) | |
89 | + | then (maxPaymentIdx == (paymentsSize - 1)) | |
90 | + | else false) | |
91 | + | then (paymentsValidation._1 == paymentsSize) | |
92 | + | else false | |
93 | + | } | |
29 | 94 | ||
30 | - | let read_shutdown_status = valueOrErrorMessage(getInteger(this, "Shutdown_Status"), "Initiate_Contract_Shutdown function value is not Set, Please Sign that first.") | |
31 | 95 | ||
32 | 96 | @Callable(i) | |
33 | - | func placeoptionCall (Amount,OptionCounterID,User_ID,User_Address,Price,Call_Limits,Put_Limits,Oracle_Status,Start_Order_Timestamp,End_Order_Timestamp) = { | |
97 | + | func massTransfer (recipients,amounts,paymentIdx,attachment) = { | |
98 | + | let pmt = value(i.payments[0]) | |
99 | + | let Amount = pmt.amount | |
100 | + | let maximum_payout_factor = 18 | |
101 | + | let Counter = split(attachment, "_")[0] | |
102 | + | let CheckTotalFundsAddedInCounter = valueOrErrorMessage(getInteger(addressFromStringValue(user_balance_address), ("Total_Funds_Added_In_Option_Order_" + Counter)), (("Counter ID: " + Counter) + " Not Found.")) | |
103 | + | let masspayoutlimits = fraction(CheckTotalFundsAddedInCounter, maximum_payout_factor, 10) | |
104 | + | if ((i.caller != masstransfer_whitelisted_address)) | |
105 | + | then throw((("Not an Admin only " + toString(masstransfer_whitelisted_address)) + " can sign it.")) | |
106 | + | else if (isDefined(pmt.assetId)) | |
107 | + | then throw("Only Waves is allowed to Attach as payment.") | |
108 | + | else if (!(validateMassTransferArguments(recipients, amounts, paymentIdx, i.payments))) | |
109 | + | then throw("Invalid arguments") | |
110 | + | else if ((Amount > masspayoutlimits)) | |
111 | + | then throw((("Attached Payment Amount is exceeding more than Maximum Eligible Limit of " + toString(masspayoutlimits)) + " Wavelets.")) | |
112 | + | else { | |
113 | + | let recipientsSize = size(recipients) | |
114 | + | func scriptTransfersGenerator (accum,next) = { | |
115 | + | let $t034273459 = accum | |
116 | + | let scriptTransfers = $t034273459._1 | |
117 | + | let j = $t034273459._2 | |
118 | + | if ((j >= recipientsSize)) | |
119 | + | then $Tuple2(scriptTransfers, (j + 1)) | |
120 | + | else $Tuple2((scriptTransfers :+ ScriptTransfer(addressFromStringValue(recipients[j]), next, i.payments[paymentIdx[j]].assetId)), (j + 1)) | |
121 | + | } | |
122 | + | ||
123 | + | let result = { | |
124 | + | let $l = amounts | |
125 | + | let $s = size($l) | |
126 | + | let $acc0 = $Tuple2(nil, 0) | |
127 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
128 | + | then $a | |
129 | + | else scriptTransfersGenerator($a, $l[$i]) | |
130 | + | ||
131 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
132 | + | then $a | |
133 | + | else throw("List size exceeds 100") | |
134 | + | ||
135 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
136 | + | } | |
137 | + | $Tuple2((result._1 ++ [IntegerEntry((Counter + "_Total_Winners"), recipientsSize)]), unit) | |
138 | + | } | |
139 | + | } | |
140 | + | ||
141 | + | ||
142 | + | ||
143 | + | @Callable(i) | |
144 | + | func AddPoolLiquidity () = { | |
34 | 145 | let calleraddress = toBase58String(i.caller.bytes) | |
35 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + User_Address)) | |
36 | - | let read_TPL = valueOrErrorMessage(getInteger(addressFromStringValue(pool_liquidity_address), "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
37 | - | let read_user_funds = getIntegerValue(((Currency_ID + "_") + User_Address)) | |
38 | - | let update_user_funds = ((read_user_funds - Amount) - network_fee) | |
39 | - | let read_start_order_permit_timestamp = Start_Order_Timestamp | |
40 | - | let read_end_order_permit_timestamp = End_Order_Timestamp | |
41 | - | let read_OptionCounterID = OptionCounterID | |
42 | - | let OpionExpireCounter = 1 | |
43 | - | let OptionExpireCounterID = (read_OptionCounterID + OpionExpireCounter) | |
44 | - | let PreviousOptionOrders = match getInteger(this, "Total_Option_Orders") { | |
146 | + | let pmt = if ((size(i.payments) == 1)) | |
147 | + | then i.payments[0] | |
148 | + | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
149 | + | let PreviousFundsAddedToPoolbyCompany = match getInteger(this, "Total_LP_Added") { | |
45 | 150 | case a: Int => | |
46 | 151 | a | |
47 | 152 | case _ => | |
48 | 153 | 0 | |
49 | 154 | } | |
50 | - | let | |
51 | - | let | |
155 | + | let TotalFundsAddedToPoolbyCompany = (PreviousFundsAddedToPoolbyCompany + pmt.amount) | |
156 | + | let PreviousPoolLiquidity = match getInteger(this, "Total_Pool_Liquidity") { | |
52 | 157 | case a: Int => | |
53 | 158 | a | |
54 | 159 | case _ => | |
55 | 160 | 0 | |
56 | 161 | } | |
57 | - | let | |
58 | - | let | |
162 | + | let TotalPoolLiquidity = (PreviousPoolLiquidity + pmt.amount) | |
163 | + | let PreviousLPDepositCounter = match getInteger(this, "LP_Deposit_Counter") { | |
59 | 164 | case a: Int => | |
60 | 165 | a | |
61 | 166 | case _ => | |
62 | 167 | 0 | |
63 | 168 | } | |
64 | - | let TotalOptionOrdersinSpecificCounter = (PreviousOptionOrdersinSpecificCounter + 1) | |
65 | - | let PreviousCall = match getInteger(this, "Total_Calls") { | |
169 | + | let TotalLPDepositCounter = (PreviousLPDepositCounter + 1) | |
170 | + | if ((i.caller != lp_whitelist_address)) | |
171 | + | then throw((("This Address is not Authorized. Only " + toString(lp_whitelist_address)) + " is Authorized Address to Sign it.")) | |
172 | + | else if (isDefined(pmt.assetId)) | |
173 | + | then throw("Only WAVES is allowed to deposit at the moment") | |
174 | + | else [IntegerEntry("Total_Pool_Liquidity", TotalPoolLiquidity), IntegerEntry("LP_Deposit_Counter", TotalLPDepositCounter), IntegerEntry("Total_LP_Added", TotalFundsAddedToPoolbyCompany)] | |
175 | + | } | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func UpdateLPBalance (PaidMassTransferAmount) = { | |
181 | + | let read_account_balance = wavesBalance(this).regular | |
182 | + | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
183 | + | let received_order_amount = ((read_account_balance - read_total_pool_liquidity) - network_fee) | |
184 | + | let updated_pool_balance = ((read_total_pool_liquidity - PaidMassTransferAmount) + received_order_amount) | |
185 | + | let PreviousMassTransferCounter = match getInteger(this, "Mass_Transfer_Counter") { | |
66 | 186 | case a: Int => | |
67 | 187 | a | |
68 | 188 | case _ => | |
69 | 189 | 0 | |
70 | 190 | } | |
71 | - | let | |
72 | - | let | |
191 | + | let TotalMassTransferCounter = (PreviousMassTransferCounter + 1) | |
192 | + | let PreviousMassTransferSend = match getInteger(this, "Total_Mass_Transfer_Send") { | |
73 | 193 | case a: Int => | |
74 | 194 | a | |
75 | 195 | case _ => | |
76 | 196 | 0 | |
77 | 197 | } | |
78 | - | let TotalCallinSpecificCounter = (PreviousCallinSpecificCounter + 1) | |
79 | - | let PreviousUserCall = match getInteger(this, (User_Address + "_Total_Calls")) { | |
198 | + | let TotalMassTransferSend = (PreviousMassTransferSend + PaidMassTransferAmount) | |
199 | + | if ((i.caller != masstransfer_whitelisted_address)) | |
200 | + | then throw((("This Address is not Authorized. Only " + toString(masstransfer_whitelisted_address)) + " is Authorized Address to Sign it.")) | |
201 | + | else if ((PaidMassTransferAmount > read_total_pool_liquidity)) | |
202 | + | then throw("Placed Mass Transfer Amount Size is more than Total Pool Liquidity.") | |
203 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("Mass_Transfer_Counter", TotalMassTransferCounter), IntegerEntry("Total_Mass_Transfer_Send", TotalMassTransferSend), IntegerEntry((toString(TotalMassTransferCounter) + "_Mass_Transfer_Send"), PaidMassTransferAmount), ScriptTransfer(masstransfer_whitelisted_address, PaidMassTransferAmount, unit), ScriptTransfer(masstransfer_whitelisted_address, network_fee, unit)] | |
204 | + | } | |
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | @Callable(i) | |
209 | + | func WithdrawLPBalance (WithdrawAmount) = { | |
210 | + | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
211 | + | let updated_pool_balance = (read_total_pool_liquidity - WithdrawAmount) | |
212 | + | let PreviousLPWithdrawCounter = match getInteger(this, "LP_Withdraw_Counter") { | |
80 | 213 | case a: Int => | |
81 | 214 | a | |
82 | 215 | case _ => | |
83 | 216 | 0 | |
84 | 217 | } | |
85 | - | let | |
86 | - | let | |
218 | + | let TotalLPWithdrawCounter = (PreviousLPWithdrawCounter + 1) | |
219 | + | let PreviousLPWithdraw = match getInteger(this, "Total_LP_Withdraw") { | |
87 | 220 | case a: Int => | |
88 | 221 | a | |
89 | 222 | case _ => | |
90 | 223 | 0 | |
91 | 224 | } | |
92 | - | let TotalUserCallinSpecificCounter = (PreviousUserCallinSpecificCounter + 1) | |
93 | - | let Funds_at_risk = fraction(read_TPL, 5, 100) | |
94 | - | if ((i.caller != whitelist_address)) | |
95 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
96 | - | else if ((read_shutdown_status == 1)) | |
97 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
98 | - | else if ((product_launch_timestamp > lastBlock.timestamp)) | |
99 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
100 | - | else if ((Oracle_Status == "CLOSE")) | |
101 | - | then throw(closed_oracle_eror) | |
102 | - | else if ((ifBlacklisted == "Yes")) | |
103 | - | then throw((User_Address + " Address is Blacklisted. Please contact Admin to Whitelist it.")) | |
104 | - | else if ((lastBlock.timestamp >= read_end_order_permit_timestamp)) | |
105 | - | then throw("Option Order placing Timing Limits are Over. Please Join in Next Cycle.") | |
106 | - | else if ((TotalFundsAddedInSpecificOptionOrder > Funds_at_risk)) | |
107 | - | then throw((((("No more orders accepted, Option House Risk Size is only limited to " + toString(Funds_at_risk)) + ", Pending House Risk is ") + toString((Funds_at_risk - PreviousFundsAddedInSpecificOptionOrder))) + ". Join in next Cycle.")) | |
108 | - | else if ((minimum_order_size > Amount)) | |
109 | - | then throw((("Placed Order Size is less than [" + toString(minimum_order_size)) + "/10^8] WAVES.")) | |
110 | - | else if ((Amount > maximum_order_size)) | |
111 | - | then throw((("Placed Order Size is more than [" + toString(maximum_order_size)) + "/10^8] WAVES.")) | |
112 | - | else if ((0 > update_user_funds)) | |
113 | - | then throw(("Placed Order Amount is going negative. Please reduce the Order Size. Negative Fund Amount = " + toString(update_user_funds))) | |
114 | - | else if ((size(toString(Start_Order_Timestamp)) != 13)) | |
115 | - | then throw("Start Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
116 | - | else if ((size(toString(End_Order_Timestamp)) != 13)) | |
117 | - | then throw("End Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
118 | - | else [StringEntry(("User_ID_" + User_Address), User_ID), IntegerEntry(((Currency_ID + "_") + User_Address), update_user_funds), IntegerEntry("Network_Fee_To_Place_Order", network_fee), StringEntry(((("Call_" + User_Address) + "_") + toString(TotalUserCall)), toString(Price)), IntegerEntry(((("Call_Amount_" + User_Address) + "_") + toString(TotalUserCall)), Amount), StringEntry(((("Call_Start_End_" + User_Address) + "_") + toString(TotalUserCall)), ((toString(read_OptionCounterID) + "_") + toString(OptionExpireCounterID))), IntegerEntry("Total_Option_Orders", TotalOptionOrders), IntegerEntry(("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID)), TotalFundsAddedInSpecificOptionOrder), IntegerEntry("Total_Pool_Liquidity", read_TPL), IntegerEntry(("Funds_At_Risk_" + toString(read_OptionCounterID)), Funds_at_risk), IntegerEntry("Call_Limits", Call_Limits), IntegerEntry("Put_Limits", Put_Limits), IntegerEntry(("Total_Option_Orders_" + toString(read_OptionCounterID)), TotalOptionOrdersinSpecificCounter), IntegerEntry("Total_Calls", TotalCall), IntegerEntry(("Total_Calls_" + toString(read_OptionCounterID)), TotalCallinSpecificCounter), IntegerEntry((User_Address + "_Total_Calls"), TotalUserCall), IntegerEntry(((User_Address + "_Total_Calls_") + toString(read_OptionCounterID)), TotalUserCallinSpecificCounter), ScriptTransfer(whitelist_address, network_fee, unit), ScriptTransfer(addressFromStringValue(pool_liquidity_address), Amount, unit)] | |
119 | - | } | |
120 | - | ||
121 | - | ||
122 | - | ||
123 | - | @Callable(i) | |
124 | - | func placeoptionPut (Amount,OptionCounterID,User_ID,User_Address,Price,Call_Limits,Put_Limits,Oracle_Status,Start_Order_Timestamp,End_Order_Timestamp) = { | |
125 | - | let calleraddress = toBase58String(i.caller.bytes) | |
126 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + User_Address)) | |
127 | - | let read_TPL = valueOrErrorMessage(getInteger(addressFromStringValue(pool_liquidity_address), "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
128 | - | let read_user_funds = getIntegerValue(((Currency_ID + "_") + User_Address)) | |
129 | - | let update_user_funds = ((read_user_funds - Amount) - network_fee) | |
130 | - | let read_start_order_permit_timestamp = Start_Order_Timestamp | |
131 | - | let read_end_order_permit_timestamp = End_Order_Timestamp | |
132 | - | let read_OptionCounterID = OptionCounterID | |
133 | - | let OpionExpireCounter = 1 | |
134 | - | let OptionExpireCounterID = (read_OptionCounterID + OpionExpireCounter) | |
135 | - | let PreviousOptionOrders = match getInteger(this, "Total_Option_Orders") { | |
136 | - | case a: Int => | |
137 | - | a | |
138 | - | case _ => | |
139 | - | 0 | |
140 | - | } | |
141 | - | let TotalOptionOrders = (PreviousOptionOrders + 1) | |
142 | - | let PreviousFundsAddedInSpecificOptionOrder = match getInteger(this, ("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID))) { | |
143 | - | case a: Int => | |
144 | - | a | |
145 | - | case _ => | |
146 | - | 0 | |
147 | - | } | |
148 | - | let TotalFundsAddedInSpecificOptionOrder = (PreviousFundsAddedInSpecificOptionOrder + Amount) | |
149 | - | let PreviousOptionOrdersinSpecificCounter = match getInteger(this, ("Total_Option_Orders_" + toString(read_OptionCounterID))) { | |
150 | - | case a: Int => | |
151 | - | a | |
152 | - | case _ => | |
153 | - | 0 | |
154 | - | } | |
155 | - | let TotalOptionOrdersinSpecificCounter = (PreviousOptionOrdersinSpecificCounter + 1) | |
156 | - | let PreviousPut = match getInteger(this, "Total_Puts") { | |
157 | - | case a: Int => | |
158 | - | a | |
159 | - | case _ => | |
160 | - | 0 | |
161 | - | } | |
162 | - | let TotalPut = (PreviousPut + 1) | |
163 | - | let PreviousPutinSpecificCounter = match getInteger(this, ("Total_Puts_" + toString(read_OptionCounterID))) { | |
164 | - | case a: Int => | |
165 | - | a | |
166 | - | case _ => | |
167 | - | 0 | |
168 | - | } | |
169 | - | let TotalPutinSpecificCounter = (PreviousPutinSpecificCounter + 1) | |
170 | - | let PreviousUserPut = match getInteger(this, (User_Address + "_Total_Puts")) { | |
171 | - | case a: Int => | |
172 | - | a | |
173 | - | case _ => | |
174 | - | 0 | |
175 | - | } | |
176 | - | let TotalUserPut = (PreviousUserPut + 1) | |
177 | - | let PreviousUserPutinSpecificCounter = match getInteger(this, ((User_Address + "_Total_Puts_") + toString(read_OptionCounterID))) { | |
178 | - | case a: Int => | |
179 | - | a | |
180 | - | case _ => | |
181 | - | 0 | |
182 | - | } | |
183 | - | let TotalUserPutinSpecificCounter = (PreviousUserPutinSpecificCounter + 1) | |
184 | - | let Funds_at_risk = fraction(read_TPL, 5, 100) | |
185 | - | if ((i.caller != whitelist_address)) | |
186 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
187 | - | else if ((read_shutdown_status == 1)) | |
188 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
189 | - | else if ((product_launch_timestamp > lastBlock.timestamp)) | |
190 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
191 | - | else if ((Oracle_Status == "CLOSE")) | |
192 | - | then throw(closed_oracle_eror) | |
193 | - | else if ((ifBlacklisted == "Yes")) | |
194 | - | then throw((User_Address + " Address is Blacklisted. Please contact Admin to Whitelist it.")) | |
195 | - | else if ((lastBlock.timestamp >= read_end_order_permit_timestamp)) | |
196 | - | then throw("Option Order placing Timing Limits are Over. Please Join in Next Cycle.") | |
197 | - | else if ((TotalFundsAddedInSpecificOptionOrder > Funds_at_risk)) | |
198 | - | then throw((((("No more orders accepted, Option House Risk Size is only limited to " + toString(Funds_at_risk)) + ", Pending House Risk is ") + toString((Funds_at_risk - PreviousFundsAddedInSpecificOptionOrder))) + ". Join in next Cycle.")) | |
199 | - | else if ((minimum_order_size > Amount)) | |
200 | - | then throw((("Placed Order Size is less than [" + toString(minimum_order_size)) + "/10^8] WAVES.")) | |
201 | - | else if ((Amount > maximum_order_size)) | |
202 | - | then throw((("Placed Order Size is more than [" + toString(maximum_order_size)) + "/10^8] WAVES.")) | |
203 | - | else if ((0 > update_user_funds)) | |
204 | - | then throw(("Placed Order Amount is going negative. Please reduce the Order Size. Negative Fund Amount = " + toString(update_user_funds))) | |
205 | - | else if ((size(toString(Start_Order_Timestamp)) != 13)) | |
206 | - | then throw("Start Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
207 | - | else if ((size(toString(End_Order_Timestamp)) != 13)) | |
208 | - | then throw("End Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
209 | - | else [StringEntry(("User_ID_" + User_Address), User_ID), IntegerEntry(((Currency_ID + "_") + User_Address), update_user_funds), IntegerEntry("Network_Fee_To_Place_Order", network_fee), StringEntry(((("Put_" + User_Address) + "_") + toString(TotalUserPut)), toString(Price)), IntegerEntry(((("Put_Amount_" + User_Address) + "_") + toString(TotalUserPut)), Amount), StringEntry(((("Put_Start_End_" + User_Address) + "_") + toString(TotalUserPut)), ((toString(read_OptionCounterID) + "_") + toString(OptionExpireCounterID))), IntegerEntry("Total_Option_Orders", TotalOptionOrders), IntegerEntry(("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID)), TotalFundsAddedInSpecificOptionOrder), IntegerEntry("Total_Pool_Liquidity", read_TPL), IntegerEntry(("Funds_At_Risk_" + toString(read_OptionCounterID)), Funds_at_risk), IntegerEntry("Call_Limits", Call_Limits), IntegerEntry("Put_Limits", Put_Limits), IntegerEntry(("Total_Option_Orders_" + toString(read_OptionCounterID)), TotalOptionOrdersinSpecificCounter), IntegerEntry("Total_Puts", TotalPut), IntegerEntry(("Total_Puts_" + toString(read_OptionCounterID)), TotalPutinSpecificCounter), IntegerEntry((User_Address + "_Total_Puts"), TotalUserPut), IntegerEntry(((User_Address + "_Total_Puts_") + toString(read_OptionCounterID)), TotalUserPutinSpecificCounter), ScriptTransfer(whitelist_address, network_fee, unit), ScriptTransfer(addressFromStringValue(pool_liquidity_address), Amount, unit)] | |
210 | - | } | |
211 | - | ||
212 | - | ||
213 | - | ||
214 | - | @Callable(i) | |
215 | - | func Fill_Vouchers_Liquidity () = { | |
216 | - | let calleraddress = toBase58String(i.caller.bytes) | |
217 | - | let pmt = if ((size(i.payments) == 1)) | |
218 | - | then i.payments[0] | |
219 | - | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
220 | - | let PreviousVouchersBalance = match getInteger(this, "Available_Vouchers_Balance") { | |
221 | - | case a: Int => | |
222 | - | a | |
223 | - | case _ => | |
224 | - | 0 | |
225 | - | } | |
226 | - | let TotalVouchersBalance = (PreviousVouchersBalance + pmt.amount) | |
227 | - | let PreviousVouchersCounterID = match getInteger(this, "Vouchers_Counter_ID") { | |
228 | - | case a: Int => | |
229 | - | a | |
230 | - | case _ => | |
231 | - | 0 | |
232 | - | } | |
233 | - | let TotalVouchersCounterID = (PreviousVouchersCounterID + 1) | |
234 | - | if (isDefined(pmt.assetId)) | |
235 | - | then throw("Only WAVES is allowed to deposit at the moment") | |
236 | - | else if ((read_shutdown_status == 1)) | |
237 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
238 | - | else [IntegerEntry("Available_Vouchers_Balance", TotalVouchersBalance), IntegerEntry((toString(TotalVouchersCounterID) + "_Voucher_Added_Amount"), pmt.amount), IntegerEntry("Vouchers_Counter_ID", TotalVouchersCounterID)] | |
239 | - | } | |
240 | - | ||
241 | - | ||
242 | - | ||
243 | - | @Callable(i) | |
244 | - | func Issue_Vouchers (User_ID,User_Address) = { | |
245 | - | let Voucher_Amount = 50000000 | |
246 | - | let read_TotalVouchersBalance = valueOrErrorMessage(getInteger(this, "Available_Vouchers_Balance"), "Available_Vouchers_Balance Entry is not Found. Initiate Fill_Vouchers_Liquidity Function first.") | |
247 | - | let update_TotalVouchersBalance = (read_TotalVouchersBalance - Voucher_Amount) | |
248 | - | let VouchersIssuedToUser = match getInteger(this, ("Total_Vouchers_Issued_To_" + User_Address)) { | |
249 | - | case a: Int => | |
250 | - | a | |
251 | - | case _ => | |
252 | - | 0 | |
253 | - | } | |
254 | - | let TotalVouchersIssuedToUser = (VouchersIssuedToUser + 1) | |
255 | - | let VouchersAmountIssuedToUser = match getInteger(this, ("Total_Vouchers_Amount_Issued_To_" + User_Address)) { | |
256 | - | case a: Int => | |
257 | - | a | |
258 | - | case _ => | |
259 | - | 0 | |
260 | - | } | |
261 | - | let TotalVouchersAmountIssuedToUser = (VouchersAmountIssuedToUser + Voucher_Amount) | |
262 | - | let PreviousVouchersBalanceofUser = match getInteger(this, ((Currency_ID + "_") + User_Address)) { | |
263 | - | case a: Int => | |
264 | - | a | |
265 | - | case _ => | |
266 | - | 0 | |
267 | - | } | |
268 | - | let TotalVouchersBalanceofUser = (PreviousVouchersBalanceofUser + Voucher_Amount) | |
269 | - | if ((i.caller != whitelist_address)) | |
270 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
271 | - | else if ((read_shutdown_status == 1)) | |
272 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
273 | - | else if ((0 >= Voucher_Amount)) | |
274 | - | then throw((("Voucher Balance can't be 0 or go in negative State. Increase the Voucher Amount where maximum limit is " + toString(maximum_voucher_size)) + "/10^8 Waves.")) | |
275 | - | else if ((0 >= update_TotalVouchersBalance)) | |
276 | - | then throw((("Updated Voucher Balance can't go in negative State of " + toString(update_TotalVouchersBalance)) + " /10^8 WAVES. Reduce the Voucher Amount.")) | |
277 | - | else if ((Voucher_Amount > maximum_voucher_size)) | |
278 | - | then throw((("Input Voucher Balance can't exceed the set maximum limit of " + toString(maximum_voucher_size)) + "/10^8 Waves.")) | |
279 | - | else if ((TotalVouchersBalanceofUser > maximum_voucher_size)) | |
280 | - | then throw((((User_Address + " Voucher Balance is exceeding the limit of ") + toString(maximum_voucher_size)) + "/10^8 Waves.")) | |
281 | - | else [IntegerEntry(("Total_Vouchers_Issued_To_" + User_Address), TotalVouchersIssuedToUser), IntegerEntry(("Total_Vouchers_Amount_Issued_To_" + User_Address), TotalVouchersAmountIssuedToUser), IntegerEntry(((Currency_ID + "_") + User_Address), TotalVouchersBalanceofUser), IntegerEntry("Available_Vouchers_Balance", update_TotalVouchersBalance)] | |
282 | - | } | |
283 | - | ||
284 | - | ||
285 | - | ||
286 | - | @Callable(i) | |
287 | - | func DepositUserFunds () = { | |
288 | - | let calleraddress = toBase58String(i.caller.bytes) | |
289 | - | let pmt = if ((size(i.payments) == 1)) | |
290 | - | then i.payments[0] | |
291 | - | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
292 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + calleraddress)) | |
293 | - | let PreviousUserDeposit = match getInteger(this, ((Currency_ID + "_") + calleraddress)) { | |
294 | - | case a: Int => | |
295 | - | a | |
296 | - | case _ => | |
297 | - | 0 | |
298 | - | } | |
299 | - | let TotalUserDeposit = (PreviousUserDeposit + pmt.amount) | |
300 | - | let PreviousDepositCounterID = match getInteger(this, "Deposit_Counter_ID") { | |
301 | - | case a: Int => | |
302 | - | a | |
303 | - | case _ => | |
304 | - | 0 | |
305 | - | } | |
306 | - | let TotalDepositCounterID = (PreviousDepositCounterID + 1) | |
307 | - | if ((product_launch_timestamp > lastBlock.timestamp)) | |
308 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
309 | - | else if ((read_shutdown_status == 1)) | |
310 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
311 | - | else if ((ifBlacklisted == "Yes")) | |
312 | - | then throw((calleraddress + " Address is Blacklisted. Please contact Admin to Whitelist it.")) | |
313 | - | else if (isDefined(pmt.assetId)) | |
314 | - | then throw("Only WAVES is allowed to deposit at the moment") | |
315 | - | else [IntegerEntry(((Currency_ID + "_") + calleraddress), TotalUserDeposit), IntegerEntry(((((toString(TotalDepositCounterID) + "_") + Currency_ID) + "_") + calleraddress), pmt.amount), IntegerEntry("Deposit_Counter_ID", TotalDepositCounterID)] | |
316 | - | } | |
317 | - | ||
318 | - | ||
319 | - | ||
320 | - | @Callable(i) | |
321 | - | func WithdrawUserFunds (User_Address,Amount) = { | |
322 | - | let calleraddress = toBase58String(i.caller.bytes) | |
323 | - | let readuserbalance = getIntegerValue(((Currency_ID + "_") + User_Address)) | |
324 | - | let update_user_funds = ((readuserbalance - Amount) - network_fee) | |
325 | - | let minimim_withdraw_amount = 10000000 | |
326 | - | if ((i.caller != whitelist_address)) | |
327 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
328 | - | else if ((read_shutdown_status == 1)) | |
329 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
330 | - | else if ((minimim_withdraw_amount > Amount)) | |
331 | - | then throw((("Minimum Withdraw Amount is " + toString(minimim_withdraw_amount)) + "/10^8] WAVES.")) | |
332 | - | else if ((0 > update_user_funds)) | |
333 | - | then throw((("Placed Withdraw Amount is going in negative State of " + toString(update_user_funds)) + "/10^8] WAVES.")) | |
334 | - | else [IntegerEntry("Previous_Balance", readuserbalance), IntegerEntry("Network_Fee_To_Withdraw", network_fee), IntegerEntry(((Currency_ID + "_") + User_Address), update_user_funds), ScriptTransfer(whitelist_address, network_fee, unit), ScriptTransfer(addressFromStringValue(User_Address), Amount, unit)] | |
335 | - | } | |
336 | - | ||
337 | - | ||
338 | - | ||
339 | - | @Callable(i) | |
340 | - | func BlackListAddress (UserAddress) = { | |
341 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + UserAddress)) | |
342 | - | let PreviousBlackListAddress = match getInteger(this, "Total_Black_Listed_Address") { | |
343 | - | case a: Int => | |
344 | - | a | |
345 | - | case _ => | |
346 | - | 0 | |
347 | - | } | |
348 | - | let TotalBlackListAddress = (PreviousBlackListAddress + 1) | |
349 | - | if ((product_launch_timestamp > lastBlock.timestamp)) | |
350 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
351 | - | else if ((i.caller != whitelist_address)) | |
352 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
353 | - | else if ((read_shutdown_status == 1)) | |
354 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
355 | - | else if ((ifBlacklisted == "Yes")) | |
356 | - | then throw("Address is already available in Blacklist.") | |
357 | - | else [StringEntry(("addr_BLACKLISTED_" + UserAddress), "Yes"), IntegerEntry("Total_Black_Listed_Address", TotalBlackListAddress)] | |
358 | - | } | |
359 | - | ||
360 | - | ||
361 | - | ||
362 | - | @Callable(i) | |
363 | - | func DeleteBlackListAddress (UserAddress) = { | |
364 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + UserAddress)) | |
365 | - | let PreviousBlackListAddress = match getInteger(this, "Total_Black_Listed_Address") { | |
366 | - | case a: Int => | |
367 | - | a | |
368 | - | case _ => | |
369 | - | 0 | |
370 | - | } | |
371 | - | let TotalBlackListAddress = (PreviousBlackListAddress - 1) | |
372 | - | if ((product_launch_timestamp > lastBlock.timestamp)) | |
373 | - | then throw(("Product Launch Timestamp is set at " + toString(product_launch_timestamp))) | |
374 | - | else if ((i.caller != whitelist_address)) | |
375 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
376 | - | else if ((read_shutdown_status == 1)) | |
377 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
378 | - | else if ((ifBlacklisted == "Yes")) | |
379 | - | then [DeleteEntry(("addr_BLACKLISTED_" + UserAddress)), IntegerEntry("Total_Black_Listed_Address", TotalBlackListAddress)] | |
380 | - | else throw("Address is not available in Blacklist.") | |
381 | - | } | |
382 | - | ||
383 | - | ||
384 | - | ||
385 | - | @Callable(i) | |
386 | - | func Initiate_Contract_Shutdown () = { | |
387 | - | let addShutdownStatus = match getInteger(this, "Shutdown_Status") { | |
388 | - | case a: Int => | |
389 | - | a | |
390 | - | case _ => | |
391 | - | 0 | |
392 | - | } | |
393 | - | if ((i.caller != whitelist_address)) | |
394 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
395 | - | else if ((addShutdownStatus == 0)) | |
396 | - | then [IntegerEntry("Shutdown_Status", 1)] | |
397 | - | else [IntegerEntry("Shutdown_Status", 0)] | |
225 | + | let TotalLPWithdraw = (PreviousLPWithdraw + WithdrawAmount) | |
226 | + | if ((i.caller != lp_whitelist_address)) | |
227 | + | then throw((("This Address is not Authorized. Only " + toString(lp_whitelist_address)) + " is Authorized Address to Sign it.")) | |
228 | + | else if ((WithdrawAmount > read_total_pool_liquidity)) | |
229 | + | then throw("Placed Withdraw Amount Size is more than Total Pool Liquidity.") | |
230 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("LP_Withdraw_Counter", TotalLPWithdrawCounter), IntegerEntry("Total_LP_Withdraw", TotalLPWithdraw), IntegerEntry((toString(TotalLPWithdrawCounter) + "_LP_Withdraw"), WithdrawAmount), ScriptTransfer(lp_whitelist_address, WithdrawAmount, unit)] | |
398 | 231 | } | |
399 | 232 | ||
400 | 233 | ||
401 | 234 | @Verifier(tx) | |
402 | 235 | func verify () = match tx { | |
403 | - | case t: Order|ExchangeTransaction| | |
236 | + | case t: Order|ExchangeTransaction|TransferTransaction => | |
404 | 237 | false | |
405 | 238 | case _ => | |
406 | 239 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let user_balance_address = "3N1s2w4NHgbrXxNZXH9RtaVT9ptHRJcgSp2" | |
5 | 5 | ||
6 | - | let | |
6 | + | let lp_address_pubkey = base58'EXLfxKmqhQPiProBaoPatTentUSZX5Dd8A8bYDcmfNwt' | |
7 | 7 | ||
8 | - | let | |
8 | + | let masstransfer_whitelisted_address = addressFromPublicKey(lp_address_pubkey) | |
9 | 9 | ||
10 | - | let | |
10 | + | let lp_depositor_address = base58'BY8Zzs9J1T1DuiWMW4QKgbVAC99HYARVSxV4gd8fN7A' | |
11 | 11 | ||
12 | - | let | |
12 | + | let lp_whitelist_address = addressFromPublicKey(lp_depositor_address) | |
13 | 13 | ||
14 | - | let | |
14 | + | let network_fee = 500000 | |
15 | 15 | ||
16 | - | let closed_oracle_eror = "Oracle is closed. Wait Until Oracle is Turned On." | |
16 | + | func validateMassTransferArguments (recipients,amounts,paymentIdx,payments) = { | |
17 | + | let recipientsSize = size(recipients) | |
18 | + | let amountsSize = size(amounts) | |
19 | + | let paymentIdxSize = size(paymentIdx) | |
20 | + | let paymentsSize = size(payments) | |
21 | + | let minAmount = min(amounts) | |
22 | + | let minPaymentIdx = min(paymentIdx) | |
23 | + | let maxPaymentIdx = max(paymentIdx) | |
24 | + | func paymentsValidator (paymentAccum,nextPayment) = { | |
25 | + | let $t014481485 = paymentAccum | |
26 | + | let validPayments = $t014481485._1 | |
27 | + | let j = $t014481485._2 | |
28 | + | if ((j >= paymentsSize)) | |
29 | + | then $Tuple2(validPayments, (j + 1)) | |
30 | + | else { | |
31 | + | func amountsAggregator (amountAccum,nextAmount) = { | |
32 | + | let $t016121641 = amountAccum | |
33 | + | let amount = $t016121641._1 | |
34 | + | let k = $t016121641._2 | |
35 | + | if (if ((k >= recipientsSize)) | |
36 | + | then true | |
37 | + | else (paymentIdx[k] != j)) | |
38 | + | then $Tuple2(amount, (k + 1)) | |
39 | + | else $Tuple2((amount + nextAmount), (k + 1)) | |
40 | + | } | |
17 | 41 | ||
18 | - | let whitelist_address = addressFromPublicKey(Dapp_Address_pub_key) | |
42 | + | let aggregatedAmount = { | |
43 | + | let $l = amounts | |
44 | + | let $s = size($l) | |
45 | + | let $acc0 = $Tuple2(0, 0) | |
46 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
47 | + | then $a | |
48 | + | else amountsAggregator($a, $l[$i]) | |
19 | 49 | ||
20 | - | let d2dcaller = addressFromPublicKey(base58'6oay51Q6zPcFP9bSwUC4Potx2KGyD4AUjpL5uLR4QeRN') | |
50 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
51 | + | then $a | |
52 | + | else throw("List size exceeds 100") | |
21 | 53 | ||
22 | - | let network_fee = 900000 | |
54 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
55 | + | } | |
56 | + | if ((aggregatedAmount._1 == nextPayment.amount)) | |
57 | + | then $Tuple2((validPayments + 1), (j + 1)) | |
58 | + | else $Tuple2(validPayments, (j + 1)) | |
59 | + | } | |
60 | + | } | |
23 | 61 | ||
24 | - | let minimum_order_size = 10000000 | |
62 | + | let paymentsValidation = { | |
63 | + | let $l = payments | |
64 | + | let $s = size($l) | |
65 | + | let $acc0 = $Tuple2(0, 0) | |
66 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
67 | + | then $a | |
68 | + | else paymentsValidator($a, $l[$i]) | |
25 | 69 | ||
26 | - | let maximum_order_size = 10000000000 | |
70 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
71 | + | then $a | |
72 | + | else throw("List size exceeds 10") | |
27 | 73 | ||
28 | - | let maximum_voucher_size = 100000000 | |
74 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
75 | + | } | |
76 | + | if (if (if (if (if (if (if (if ((recipientsSize == amountsSize)) | |
77 | + | then (recipientsSize == paymentIdxSize) | |
78 | + | else false) | |
79 | + | then (recipientsSize > 0) | |
80 | + | else false) | |
81 | + | then (100 >= recipientsSize) | |
82 | + | else false) | |
83 | + | then (paymentsSize > 0) | |
84 | + | else false) | |
85 | + | then (minAmount > 0) | |
86 | + | else false) | |
87 | + | then (minPaymentIdx == 0) | |
88 | + | else false) | |
89 | + | then (maxPaymentIdx == (paymentsSize - 1)) | |
90 | + | else false) | |
91 | + | then (paymentsValidation._1 == paymentsSize) | |
92 | + | else false | |
93 | + | } | |
29 | 94 | ||
30 | - | let read_shutdown_status = valueOrErrorMessage(getInteger(this, "Shutdown_Status"), "Initiate_Contract_Shutdown function value is not Set, Please Sign that first.") | |
31 | 95 | ||
32 | 96 | @Callable(i) | |
33 | - | func placeoptionCall (Amount,OptionCounterID,User_ID,User_Address,Price,Call_Limits,Put_Limits,Oracle_Status,Start_Order_Timestamp,End_Order_Timestamp) = { | |
97 | + | func massTransfer (recipients,amounts,paymentIdx,attachment) = { | |
98 | + | let pmt = value(i.payments[0]) | |
99 | + | let Amount = pmt.amount | |
100 | + | let maximum_payout_factor = 18 | |
101 | + | let Counter = split(attachment, "_")[0] | |
102 | + | let CheckTotalFundsAddedInCounter = valueOrErrorMessage(getInteger(addressFromStringValue(user_balance_address), ("Total_Funds_Added_In_Option_Order_" + Counter)), (("Counter ID: " + Counter) + " Not Found.")) | |
103 | + | let masspayoutlimits = fraction(CheckTotalFundsAddedInCounter, maximum_payout_factor, 10) | |
104 | + | if ((i.caller != masstransfer_whitelisted_address)) | |
105 | + | then throw((("Not an Admin only " + toString(masstransfer_whitelisted_address)) + " can sign it.")) | |
106 | + | else if (isDefined(pmt.assetId)) | |
107 | + | then throw("Only Waves is allowed to Attach as payment.") | |
108 | + | else if (!(validateMassTransferArguments(recipients, amounts, paymentIdx, i.payments))) | |
109 | + | then throw("Invalid arguments") | |
110 | + | else if ((Amount > masspayoutlimits)) | |
111 | + | then throw((("Attached Payment Amount is exceeding more than Maximum Eligible Limit of " + toString(masspayoutlimits)) + " Wavelets.")) | |
112 | + | else { | |
113 | + | let recipientsSize = size(recipients) | |
114 | + | func scriptTransfersGenerator (accum,next) = { | |
115 | + | let $t034273459 = accum | |
116 | + | let scriptTransfers = $t034273459._1 | |
117 | + | let j = $t034273459._2 | |
118 | + | if ((j >= recipientsSize)) | |
119 | + | then $Tuple2(scriptTransfers, (j + 1)) | |
120 | + | else $Tuple2((scriptTransfers :+ ScriptTransfer(addressFromStringValue(recipients[j]), next, i.payments[paymentIdx[j]].assetId)), (j + 1)) | |
121 | + | } | |
122 | + | ||
123 | + | let result = { | |
124 | + | let $l = amounts | |
125 | + | let $s = size($l) | |
126 | + | let $acc0 = $Tuple2(nil, 0) | |
127 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
128 | + | then $a | |
129 | + | else scriptTransfersGenerator($a, $l[$i]) | |
130 | + | ||
131 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
132 | + | then $a | |
133 | + | else throw("List size exceeds 100") | |
134 | + | ||
135 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
136 | + | } | |
137 | + | $Tuple2((result._1 ++ [IntegerEntry((Counter + "_Total_Winners"), recipientsSize)]), unit) | |
138 | + | } | |
139 | + | } | |
140 | + | ||
141 | + | ||
142 | + | ||
143 | + | @Callable(i) | |
144 | + | func AddPoolLiquidity () = { | |
34 | 145 | let calleraddress = toBase58String(i.caller.bytes) | |
35 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + User_Address)) | |
36 | - | let read_TPL = valueOrErrorMessage(getInteger(addressFromStringValue(pool_liquidity_address), "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
37 | - | let read_user_funds = getIntegerValue(((Currency_ID + "_") + User_Address)) | |
38 | - | let update_user_funds = ((read_user_funds - Amount) - network_fee) | |
39 | - | let read_start_order_permit_timestamp = Start_Order_Timestamp | |
40 | - | let read_end_order_permit_timestamp = End_Order_Timestamp | |
41 | - | let read_OptionCounterID = OptionCounterID | |
42 | - | let OpionExpireCounter = 1 | |
43 | - | let OptionExpireCounterID = (read_OptionCounterID + OpionExpireCounter) | |
44 | - | let PreviousOptionOrders = match getInteger(this, "Total_Option_Orders") { | |
146 | + | let pmt = if ((size(i.payments) == 1)) | |
147 | + | then i.payments[0] | |
148 | + | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
149 | + | let PreviousFundsAddedToPoolbyCompany = match getInteger(this, "Total_LP_Added") { | |
45 | 150 | case a: Int => | |
46 | 151 | a | |
47 | 152 | case _ => | |
48 | 153 | 0 | |
49 | 154 | } | |
50 | - | let | |
51 | - | let | |
155 | + | let TotalFundsAddedToPoolbyCompany = (PreviousFundsAddedToPoolbyCompany + pmt.amount) | |
156 | + | let PreviousPoolLiquidity = match getInteger(this, "Total_Pool_Liquidity") { | |
52 | 157 | case a: Int => | |
53 | 158 | a | |
54 | 159 | case _ => | |
55 | 160 | 0 | |
56 | 161 | } | |
57 | - | let | |
58 | - | let | |
162 | + | let TotalPoolLiquidity = (PreviousPoolLiquidity + pmt.amount) | |
163 | + | let PreviousLPDepositCounter = match getInteger(this, "LP_Deposit_Counter") { | |
59 | 164 | case a: Int => | |
60 | 165 | a | |
61 | 166 | case _ => | |
62 | 167 | 0 | |
63 | 168 | } | |
64 | - | let TotalOptionOrdersinSpecificCounter = (PreviousOptionOrdersinSpecificCounter + 1) | |
65 | - | let PreviousCall = match getInteger(this, "Total_Calls") { | |
169 | + | let TotalLPDepositCounter = (PreviousLPDepositCounter + 1) | |
170 | + | if ((i.caller != lp_whitelist_address)) | |
171 | + | then throw((("This Address is not Authorized. Only " + toString(lp_whitelist_address)) + " is Authorized Address to Sign it.")) | |
172 | + | else if (isDefined(pmt.assetId)) | |
173 | + | then throw("Only WAVES is allowed to deposit at the moment") | |
174 | + | else [IntegerEntry("Total_Pool_Liquidity", TotalPoolLiquidity), IntegerEntry("LP_Deposit_Counter", TotalLPDepositCounter), IntegerEntry("Total_LP_Added", TotalFundsAddedToPoolbyCompany)] | |
175 | + | } | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func UpdateLPBalance (PaidMassTransferAmount) = { | |
181 | + | let read_account_balance = wavesBalance(this).regular | |
182 | + | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
183 | + | let received_order_amount = ((read_account_balance - read_total_pool_liquidity) - network_fee) | |
184 | + | let updated_pool_balance = ((read_total_pool_liquidity - PaidMassTransferAmount) + received_order_amount) | |
185 | + | let PreviousMassTransferCounter = match getInteger(this, "Mass_Transfer_Counter") { | |
66 | 186 | case a: Int => | |
67 | 187 | a | |
68 | 188 | case _ => | |
69 | 189 | 0 | |
70 | 190 | } | |
71 | - | let | |
72 | - | let | |
191 | + | let TotalMassTransferCounter = (PreviousMassTransferCounter + 1) | |
192 | + | let PreviousMassTransferSend = match getInteger(this, "Total_Mass_Transfer_Send") { | |
73 | 193 | case a: Int => | |
74 | 194 | a | |
75 | 195 | case _ => | |
76 | 196 | 0 | |
77 | 197 | } | |
78 | - | let TotalCallinSpecificCounter = (PreviousCallinSpecificCounter + 1) | |
79 | - | let PreviousUserCall = match getInteger(this, (User_Address + "_Total_Calls")) { | |
198 | + | let TotalMassTransferSend = (PreviousMassTransferSend + PaidMassTransferAmount) | |
199 | + | if ((i.caller != masstransfer_whitelisted_address)) | |
200 | + | then throw((("This Address is not Authorized. Only " + toString(masstransfer_whitelisted_address)) + " is Authorized Address to Sign it.")) | |
201 | + | else if ((PaidMassTransferAmount > read_total_pool_liquidity)) | |
202 | + | then throw("Placed Mass Transfer Amount Size is more than Total Pool Liquidity.") | |
203 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("Mass_Transfer_Counter", TotalMassTransferCounter), IntegerEntry("Total_Mass_Transfer_Send", TotalMassTransferSend), IntegerEntry((toString(TotalMassTransferCounter) + "_Mass_Transfer_Send"), PaidMassTransferAmount), ScriptTransfer(masstransfer_whitelisted_address, PaidMassTransferAmount, unit), ScriptTransfer(masstransfer_whitelisted_address, network_fee, unit)] | |
204 | + | } | |
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | @Callable(i) | |
209 | + | func WithdrawLPBalance (WithdrawAmount) = { | |
210 | + | let read_total_pool_liquidity = valueOrErrorMessage(getInteger(this, "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
211 | + | let updated_pool_balance = (read_total_pool_liquidity - WithdrawAmount) | |
212 | + | let PreviousLPWithdrawCounter = match getInteger(this, "LP_Withdraw_Counter") { | |
80 | 213 | case a: Int => | |
81 | 214 | a | |
82 | 215 | case _ => | |
83 | 216 | 0 | |
84 | 217 | } | |
85 | - | let | |
86 | - | let | |
218 | + | let TotalLPWithdrawCounter = (PreviousLPWithdrawCounter + 1) | |
219 | + | let PreviousLPWithdraw = match getInteger(this, "Total_LP_Withdraw") { | |
87 | 220 | case a: Int => | |
88 | 221 | a | |
89 | 222 | case _ => | |
90 | 223 | 0 | |
91 | 224 | } | |
92 | - | let TotalUserCallinSpecificCounter = (PreviousUserCallinSpecificCounter + 1) | |
93 | - | let Funds_at_risk = fraction(read_TPL, 5, 100) | |
94 | - | if ((i.caller != whitelist_address)) | |
95 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
96 | - | else if ((read_shutdown_status == 1)) | |
97 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
98 | - | else if ((product_launch_timestamp > lastBlock.timestamp)) | |
99 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
100 | - | else if ((Oracle_Status == "CLOSE")) | |
101 | - | then throw(closed_oracle_eror) | |
102 | - | else if ((ifBlacklisted == "Yes")) | |
103 | - | then throw((User_Address + " Address is Blacklisted. Please contact Admin to Whitelist it.")) | |
104 | - | else if ((lastBlock.timestamp >= read_end_order_permit_timestamp)) | |
105 | - | then throw("Option Order placing Timing Limits are Over. Please Join in Next Cycle.") | |
106 | - | else if ((TotalFundsAddedInSpecificOptionOrder > Funds_at_risk)) | |
107 | - | then throw((((("No more orders accepted, Option House Risk Size is only limited to " + toString(Funds_at_risk)) + ", Pending House Risk is ") + toString((Funds_at_risk - PreviousFundsAddedInSpecificOptionOrder))) + ". Join in next Cycle.")) | |
108 | - | else if ((minimum_order_size > Amount)) | |
109 | - | then throw((("Placed Order Size is less than [" + toString(minimum_order_size)) + "/10^8] WAVES.")) | |
110 | - | else if ((Amount > maximum_order_size)) | |
111 | - | then throw((("Placed Order Size is more than [" + toString(maximum_order_size)) + "/10^8] WAVES.")) | |
112 | - | else if ((0 > update_user_funds)) | |
113 | - | then throw(("Placed Order Amount is going negative. Please reduce the Order Size. Negative Fund Amount = " + toString(update_user_funds))) | |
114 | - | else if ((size(toString(Start_Order_Timestamp)) != 13)) | |
115 | - | then throw("Start Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
116 | - | else if ((size(toString(End_Order_Timestamp)) != 13)) | |
117 | - | then throw("End Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
118 | - | else [StringEntry(("User_ID_" + User_Address), User_ID), IntegerEntry(((Currency_ID + "_") + User_Address), update_user_funds), IntegerEntry("Network_Fee_To_Place_Order", network_fee), StringEntry(((("Call_" + User_Address) + "_") + toString(TotalUserCall)), toString(Price)), IntegerEntry(((("Call_Amount_" + User_Address) + "_") + toString(TotalUserCall)), Amount), StringEntry(((("Call_Start_End_" + User_Address) + "_") + toString(TotalUserCall)), ((toString(read_OptionCounterID) + "_") + toString(OptionExpireCounterID))), IntegerEntry("Total_Option_Orders", TotalOptionOrders), IntegerEntry(("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID)), TotalFundsAddedInSpecificOptionOrder), IntegerEntry("Total_Pool_Liquidity", read_TPL), IntegerEntry(("Funds_At_Risk_" + toString(read_OptionCounterID)), Funds_at_risk), IntegerEntry("Call_Limits", Call_Limits), IntegerEntry("Put_Limits", Put_Limits), IntegerEntry(("Total_Option_Orders_" + toString(read_OptionCounterID)), TotalOptionOrdersinSpecificCounter), IntegerEntry("Total_Calls", TotalCall), IntegerEntry(("Total_Calls_" + toString(read_OptionCounterID)), TotalCallinSpecificCounter), IntegerEntry((User_Address + "_Total_Calls"), TotalUserCall), IntegerEntry(((User_Address + "_Total_Calls_") + toString(read_OptionCounterID)), TotalUserCallinSpecificCounter), ScriptTransfer(whitelist_address, network_fee, unit), ScriptTransfer(addressFromStringValue(pool_liquidity_address), Amount, unit)] | |
119 | - | } | |
120 | - | ||
121 | - | ||
122 | - | ||
123 | - | @Callable(i) | |
124 | - | func placeoptionPut (Amount,OptionCounterID,User_ID,User_Address,Price,Call_Limits,Put_Limits,Oracle_Status,Start_Order_Timestamp,End_Order_Timestamp) = { | |
125 | - | let calleraddress = toBase58String(i.caller.bytes) | |
126 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + User_Address)) | |
127 | - | let read_TPL = valueOrErrorMessage(getInteger(addressFromStringValue(pool_liquidity_address), "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.") | |
128 | - | let read_user_funds = getIntegerValue(((Currency_ID + "_") + User_Address)) | |
129 | - | let update_user_funds = ((read_user_funds - Amount) - network_fee) | |
130 | - | let read_start_order_permit_timestamp = Start_Order_Timestamp | |
131 | - | let read_end_order_permit_timestamp = End_Order_Timestamp | |
132 | - | let read_OptionCounterID = OptionCounterID | |
133 | - | let OpionExpireCounter = 1 | |
134 | - | let OptionExpireCounterID = (read_OptionCounterID + OpionExpireCounter) | |
135 | - | let PreviousOptionOrders = match getInteger(this, "Total_Option_Orders") { | |
136 | - | case a: Int => | |
137 | - | a | |
138 | - | case _ => | |
139 | - | 0 | |
140 | - | } | |
141 | - | let TotalOptionOrders = (PreviousOptionOrders + 1) | |
142 | - | let PreviousFundsAddedInSpecificOptionOrder = match getInteger(this, ("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID))) { | |
143 | - | case a: Int => | |
144 | - | a | |
145 | - | case _ => | |
146 | - | 0 | |
147 | - | } | |
148 | - | let TotalFundsAddedInSpecificOptionOrder = (PreviousFundsAddedInSpecificOptionOrder + Amount) | |
149 | - | let PreviousOptionOrdersinSpecificCounter = match getInteger(this, ("Total_Option_Orders_" + toString(read_OptionCounterID))) { | |
150 | - | case a: Int => | |
151 | - | a | |
152 | - | case _ => | |
153 | - | 0 | |
154 | - | } | |
155 | - | let TotalOptionOrdersinSpecificCounter = (PreviousOptionOrdersinSpecificCounter + 1) | |
156 | - | let PreviousPut = match getInteger(this, "Total_Puts") { | |
157 | - | case a: Int => | |
158 | - | a | |
159 | - | case _ => | |
160 | - | 0 | |
161 | - | } | |
162 | - | let TotalPut = (PreviousPut + 1) | |
163 | - | let PreviousPutinSpecificCounter = match getInteger(this, ("Total_Puts_" + toString(read_OptionCounterID))) { | |
164 | - | case a: Int => | |
165 | - | a | |
166 | - | case _ => | |
167 | - | 0 | |
168 | - | } | |
169 | - | let TotalPutinSpecificCounter = (PreviousPutinSpecificCounter + 1) | |
170 | - | let PreviousUserPut = match getInteger(this, (User_Address + "_Total_Puts")) { | |
171 | - | case a: Int => | |
172 | - | a | |
173 | - | case _ => | |
174 | - | 0 | |
175 | - | } | |
176 | - | let TotalUserPut = (PreviousUserPut + 1) | |
177 | - | let PreviousUserPutinSpecificCounter = match getInteger(this, ((User_Address + "_Total_Puts_") + toString(read_OptionCounterID))) { | |
178 | - | case a: Int => | |
179 | - | a | |
180 | - | case _ => | |
181 | - | 0 | |
182 | - | } | |
183 | - | let TotalUserPutinSpecificCounter = (PreviousUserPutinSpecificCounter + 1) | |
184 | - | let Funds_at_risk = fraction(read_TPL, 5, 100) | |
185 | - | if ((i.caller != whitelist_address)) | |
186 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
187 | - | else if ((read_shutdown_status == 1)) | |
188 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
189 | - | else if ((product_launch_timestamp > lastBlock.timestamp)) | |
190 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
191 | - | else if ((Oracle_Status == "CLOSE")) | |
192 | - | then throw(closed_oracle_eror) | |
193 | - | else if ((ifBlacklisted == "Yes")) | |
194 | - | then throw((User_Address + " Address is Blacklisted. Please contact Admin to Whitelist it.")) | |
195 | - | else if ((lastBlock.timestamp >= read_end_order_permit_timestamp)) | |
196 | - | then throw("Option Order placing Timing Limits are Over. Please Join in Next Cycle.") | |
197 | - | else if ((TotalFundsAddedInSpecificOptionOrder > Funds_at_risk)) | |
198 | - | then throw((((("No more orders accepted, Option House Risk Size is only limited to " + toString(Funds_at_risk)) + ", Pending House Risk is ") + toString((Funds_at_risk - PreviousFundsAddedInSpecificOptionOrder))) + ". Join in next Cycle.")) | |
199 | - | else if ((minimum_order_size > Amount)) | |
200 | - | then throw((("Placed Order Size is less than [" + toString(minimum_order_size)) + "/10^8] WAVES.")) | |
201 | - | else if ((Amount > maximum_order_size)) | |
202 | - | then throw((("Placed Order Size is more than [" + toString(maximum_order_size)) + "/10^8] WAVES.")) | |
203 | - | else if ((0 > update_user_funds)) | |
204 | - | then throw(("Placed Order Amount is going negative. Please reduce the Order Size. Negative Fund Amount = " + toString(update_user_funds))) | |
205 | - | else if ((size(toString(Start_Order_Timestamp)) != 13)) | |
206 | - | then throw("Start Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
207 | - | else if ((size(toString(End_Order_Timestamp)) != 13)) | |
208 | - | then throw("End Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.") | |
209 | - | else [StringEntry(("User_ID_" + User_Address), User_ID), IntegerEntry(((Currency_ID + "_") + User_Address), update_user_funds), IntegerEntry("Network_Fee_To_Place_Order", network_fee), StringEntry(((("Put_" + User_Address) + "_") + toString(TotalUserPut)), toString(Price)), IntegerEntry(((("Put_Amount_" + User_Address) + "_") + toString(TotalUserPut)), Amount), StringEntry(((("Put_Start_End_" + User_Address) + "_") + toString(TotalUserPut)), ((toString(read_OptionCounterID) + "_") + toString(OptionExpireCounterID))), IntegerEntry("Total_Option_Orders", TotalOptionOrders), IntegerEntry(("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID)), TotalFundsAddedInSpecificOptionOrder), IntegerEntry("Total_Pool_Liquidity", read_TPL), IntegerEntry(("Funds_At_Risk_" + toString(read_OptionCounterID)), Funds_at_risk), IntegerEntry("Call_Limits", Call_Limits), IntegerEntry("Put_Limits", Put_Limits), IntegerEntry(("Total_Option_Orders_" + toString(read_OptionCounterID)), TotalOptionOrdersinSpecificCounter), IntegerEntry("Total_Puts", TotalPut), IntegerEntry(("Total_Puts_" + toString(read_OptionCounterID)), TotalPutinSpecificCounter), IntegerEntry((User_Address + "_Total_Puts"), TotalUserPut), IntegerEntry(((User_Address + "_Total_Puts_") + toString(read_OptionCounterID)), TotalUserPutinSpecificCounter), ScriptTransfer(whitelist_address, network_fee, unit), ScriptTransfer(addressFromStringValue(pool_liquidity_address), Amount, unit)] | |
210 | - | } | |
211 | - | ||
212 | - | ||
213 | - | ||
214 | - | @Callable(i) | |
215 | - | func Fill_Vouchers_Liquidity () = { | |
216 | - | let calleraddress = toBase58String(i.caller.bytes) | |
217 | - | let pmt = if ((size(i.payments) == 1)) | |
218 | - | then i.payments[0] | |
219 | - | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
220 | - | let PreviousVouchersBalance = match getInteger(this, "Available_Vouchers_Balance") { | |
221 | - | case a: Int => | |
222 | - | a | |
223 | - | case _ => | |
224 | - | 0 | |
225 | - | } | |
226 | - | let TotalVouchersBalance = (PreviousVouchersBalance + pmt.amount) | |
227 | - | let PreviousVouchersCounterID = match getInteger(this, "Vouchers_Counter_ID") { | |
228 | - | case a: Int => | |
229 | - | a | |
230 | - | case _ => | |
231 | - | 0 | |
232 | - | } | |
233 | - | let TotalVouchersCounterID = (PreviousVouchersCounterID + 1) | |
234 | - | if (isDefined(pmt.assetId)) | |
235 | - | then throw("Only WAVES is allowed to deposit at the moment") | |
236 | - | else if ((read_shutdown_status == 1)) | |
237 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
238 | - | else [IntegerEntry("Available_Vouchers_Balance", TotalVouchersBalance), IntegerEntry((toString(TotalVouchersCounterID) + "_Voucher_Added_Amount"), pmt.amount), IntegerEntry("Vouchers_Counter_ID", TotalVouchersCounterID)] | |
239 | - | } | |
240 | - | ||
241 | - | ||
242 | - | ||
243 | - | @Callable(i) | |
244 | - | func Issue_Vouchers (User_ID,User_Address) = { | |
245 | - | let Voucher_Amount = 50000000 | |
246 | - | let read_TotalVouchersBalance = valueOrErrorMessage(getInteger(this, "Available_Vouchers_Balance"), "Available_Vouchers_Balance Entry is not Found. Initiate Fill_Vouchers_Liquidity Function first.") | |
247 | - | let update_TotalVouchersBalance = (read_TotalVouchersBalance - Voucher_Amount) | |
248 | - | let VouchersIssuedToUser = match getInteger(this, ("Total_Vouchers_Issued_To_" + User_Address)) { | |
249 | - | case a: Int => | |
250 | - | a | |
251 | - | case _ => | |
252 | - | 0 | |
253 | - | } | |
254 | - | let TotalVouchersIssuedToUser = (VouchersIssuedToUser + 1) | |
255 | - | let VouchersAmountIssuedToUser = match getInteger(this, ("Total_Vouchers_Amount_Issued_To_" + User_Address)) { | |
256 | - | case a: Int => | |
257 | - | a | |
258 | - | case _ => | |
259 | - | 0 | |
260 | - | } | |
261 | - | let TotalVouchersAmountIssuedToUser = (VouchersAmountIssuedToUser + Voucher_Amount) | |
262 | - | let PreviousVouchersBalanceofUser = match getInteger(this, ((Currency_ID + "_") + User_Address)) { | |
263 | - | case a: Int => | |
264 | - | a | |
265 | - | case _ => | |
266 | - | 0 | |
267 | - | } | |
268 | - | let TotalVouchersBalanceofUser = (PreviousVouchersBalanceofUser + Voucher_Amount) | |
269 | - | if ((i.caller != whitelist_address)) | |
270 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
271 | - | else if ((read_shutdown_status == 1)) | |
272 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
273 | - | else if ((0 >= Voucher_Amount)) | |
274 | - | then throw((("Voucher Balance can't be 0 or go in negative State. Increase the Voucher Amount where maximum limit is " + toString(maximum_voucher_size)) + "/10^8 Waves.")) | |
275 | - | else if ((0 >= update_TotalVouchersBalance)) | |
276 | - | then throw((("Updated Voucher Balance can't go in negative State of " + toString(update_TotalVouchersBalance)) + " /10^8 WAVES. Reduce the Voucher Amount.")) | |
277 | - | else if ((Voucher_Amount > maximum_voucher_size)) | |
278 | - | then throw((("Input Voucher Balance can't exceed the set maximum limit of " + toString(maximum_voucher_size)) + "/10^8 Waves.")) | |
279 | - | else if ((TotalVouchersBalanceofUser > maximum_voucher_size)) | |
280 | - | then throw((((User_Address + " Voucher Balance is exceeding the limit of ") + toString(maximum_voucher_size)) + "/10^8 Waves.")) | |
281 | - | else [IntegerEntry(("Total_Vouchers_Issued_To_" + User_Address), TotalVouchersIssuedToUser), IntegerEntry(("Total_Vouchers_Amount_Issued_To_" + User_Address), TotalVouchersAmountIssuedToUser), IntegerEntry(((Currency_ID + "_") + User_Address), TotalVouchersBalanceofUser), IntegerEntry("Available_Vouchers_Balance", update_TotalVouchersBalance)] | |
282 | - | } | |
283 | - | ||
284 | - | ||
285 | - | ||
286 | - | @Callable(i) | |
287 | - | func DepositUserFunds () = { | |
288 | - | let calleraddress = toBase58String(i.caller.bytes) | |
289 | - | let pmt = if ((size(i.payments) == 1)) | |
290 | - | then i.payments[0] | |
291 | - | else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].") | |
292 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + calleraddress)) | |
293 | - | let PreviousUserDeposit = match getInteger(this, ((Currency_ID + "_") + calleraddress)) { | |
294 | - | case a: Int => | |
295 | - | a | |
296 | - | case _ => | |
297 | - | 0 | |
298 | - | } | |
299 | - | let TotalUserDeposit = (PreviousUserDeposit + pmt.amount) | |
300 | - | let PreviousDepositCounterID = match getInteger(this, "Deposit_Counter_ID") { | |
301 | - | case a: Int => | |
302 | - | a | |
303 | - | case _ => | |
304 | - | 0 | |
305 | - | } | |
306 | - | let TotalDepositCounterID = (PreviousDepositCounterID + 1) | |
307 | - | if ((product_launch_timestamp > lastBlock.timestamp)) | |
308 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
309 | - | else if ((read_shutdown_status == 1)) | |
310 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
311 | - | else if ((ifBlacklisted == "Yes")) | |
312 | - | then throw((calleraddress + " Address is Blacklisted. Please contact Admin to Whitelist it.")) | |
313 | - | else if (isDefined(pmt.assetId)) | |
314 | - | then throw("Only WAVES is allowed to deposit at the moment") | |
315 | - | else [IntegerEntry(((Currency_ID + "_") + calleraddress), TotalUserDeposit), IntegerEntry(((((toString(TotalDepositCounterID) + "_") + Currency_ID) + "_") + calleraddress), pmt.amount), IntegerEntry("Deposit_Counter_ID", TotalDepositCounterID)] | |
316 | - | } | |
317 | - | ||
318 | - | ||
319 | - | ||
320 | - | @Callable(i) | |
321 | - | func WithdrawUserFunds (User_Address,Amount) = { | |
322 | - | let calleraddress = toBase58String(i.caller.bytes) | |
323 | - | let readuserbalance = getIntegerValue(((Currency_ID + "_") + User_Address)) | |
324 | - | let update_user_funds = ((readuserbalance - Amount) - network_fee) | |
325 | - | let minimim_withdraw_amount = 10000000 | |
326 | - | if ((i.caller != whitelist_address)) | |
327 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
328 | - | else if ((read_shutdown_status == 1)) | |
329 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
330 | - | else if ((minimim_withdraw_amount > Amount)) | |
331 | - | then throw((("Minimum Withdraw Amount is " + toString(minimim_withdraw_amount)) + "/10^8] WAVES.")) | |
332 | - | else if ((0 > update_user_funds)) | |
333 | - | then throw((("Placed Withdraw Amount is going in negative State of " + toString(update_user_funds)) + "/10^8] WAVES.")) | |
334 | - | else [IntegerEntry("Previous_Balance", readuserbalance), IntegerEntry("Network_Fee_To_Withdraw", network_fee), IntegerEntry(((Currency_ID + "_") + User_Address), update_user_funds), ScriptTransfer(whitelist_address, network_fee, unit), ScriptTransfer(addressFromStringValue(User_Address), Amount, unit)] | |
335 | - | } | |
336 | - | ||
337 | - | ||
338 | - | ||
339 | - | @Callable(i) | |
340 | - | func BlackListAddress (UserAddress) = { | |
341 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + UserAddress)) | |
342 | - | let PreviousBlackListAddress = match getInteger(this, "Total_Black_Listed_Address") { | |
343 | - | case a: Int => | |
344 | - | a | |
345 | - | case _ => | |
346 | - | 0 | |
347 | - | } | |
348 | - | let TotalBlackListAddress = (PreviousBlackListAddress + 1) | |
349 | - | if ((product_launch_timestamp > lastBlock.timestamp)) | |
350 | - | then throw((product_launch_error + toString(product_launch_timestamp))) | |
351 | - | else if ((i.caller != whitelist_address)) | |
352 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
353 | - | else if ((read_shutdown_status == 1)) | |
354 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
355 | - | else if ((ifBlacklisted == "Yes")) | |
356 | - | then throw("Address is already available in Blacklist.") | |
357 | - | else [StringEntry(("addr_BLACKLISTED_" + UserAddress), "Yes"), IntegerEntry("Total_Black_Listed_Address", TotalBlackListAddress)] | |
358 | - | } | |
359 | - | ||
360 | - | ||
361 | - | ||
362 | - | @Callable(i) | |
363 | - | func DeleteBlackListAddress (UserAddress) = { | |
364 | - | let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + UserAddress)) | |
365 | - | let PreviousBlackListAddress = match getInteger(this, "Total_Black_Listed_Address") { | |
366 | - | case a: Int => | |
367 | - | a | |
368 | - | case _ => | |
369 | - | 0 | |
370 | - | } | |
371 | - | let TotalBlackListAddress = (PreviousBlackListAddress - 1) | |
372 | - | if ((product_launch_timestamp > lastBlock.timestamp)) | |
373 | - | then throw(("Product Launch Timestamp is set at " + toString(product_launch_timestamp))) | |
374 | - | else if ((i.caller != whitelist_address)) | |
375 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
376 | - | else if ((read_shutdown_status == 1)) | |
377 | - | then throw("Contract Status is Currently Shutdown. Please Sign the Function Initiate_Contract_Shutdown.") | |
378 | - | else if ((ifBlacklisted == "Yes")) | |
379 | - | then [DeleteEntry(("addr_BLACKLISTED_" + UserAddress)), IntegerEntry("Total_Black_Listed_Address", TotalBlackListAddress)] | |
380 | - | else throw("Address is not available in Blacklist.") | |
381 | - | } | |
382 | - | ||
383 | - | ||
384 | - | ||
385 | - | @Callable(i) | |
386 | - | func Initiate_Contract_Shutdown () = { | |
387 | - | let addShutdownStatus = match getInteger(this, "Shutdown_Status") { | |
388 | - | case a: Int => | |
389 | - | a | |
390 | - | case _ => | |
391 | - | 0 | |
392 | - | } | |
393 | - | if ((i.caller != whitelist_address)) | |
394 | - | then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it.")) | |
395 | - | else if ((addShutdownStatus == 0)) | |
396 | - | then [IntegerEntry("Shutdown_Status", 1)] | |
397 | - | else [IntegerEntry("Shutdown_Status", 0)] | |
225 | + | let TotalLPWithdraw = (PreviousLPWithdraw + WithdrawAmount) | |
226 | + | if ((i.caller != lp_whitelist_address)) | |
227 | + | then throw((("This Address is not Authorized. Only " + toString(lp_whitelist_address)) + " is Authorized Address to Sign it.")) | |
228 | + | else if ((WithdrawAmount > read_total_pool_liquidity)) | |
229 | + | then throw("Placed Withdraw Amount Size is more than Total Pool Liquidity.") | |
230 | + | else [IntegerEntry("Total_Pool_Liquidity", updated_pool_balance), IntegerEntry("LP_Withdraw_Counter", TotalLPWithdrawCounter), IntegerEntry("Total_LP_Withdraw", TotalLPWithdraw), IntegerEntry((toString(TotalLPWithdrawCounter) + "_LP_Withdraw"), WithdrawAmount), ScriptTransfer(lp_whitelist_address, WithdrawAmount, unit)] | |
398 | 231 | } | |
399 | 232 | ||
400 | 233 | ||
401 | 234 | @Verifier(tx) | |
402 | 235 | func verify () = match tx { | |
403 | - | case t: Order|ExchangeTransaction| | |
236 | + | case t: Order|ExchangeTransaction|TransferTransaction => | |
404 | 237 | false | |
405 | 238 | case _ => | |
406 | 239 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
407 | 240 | } | |
408 | 241 |
github/deemru/w8io/169f3d6 84.65 ms ◑![]()