tx · 85Txx2Kf6H2Zahr1eDEP6BLED2wSVPECToizPUw6jCHN

3N41aT37TbyjqseLsNfircawJJdFAc2yRqX:  -0.01000000 Waves

2023.11.28 12:50 [2863083] smart account 3N41aT37TbyjqseLsNfircawJJdFAc2yRqX > SELF 0.00000000 Waves

{ "type": 13, "id": "85Txx2Kf6H2Zahr1eDEP6BLED2wSVPECToizPUw6jCHN", "fee": 1000000, "feeAssetId": null, "timestamp": 1701165060016, "version": 2, "chainId": 84, "sender": "3N41aT37TbyjqseLsNfircawJJdFAc2yRqX", "senderPublicKey": "EXLfxKmqhQPiProBaoPatTentUSZX5Dd8A8bYDcmfNwt", "proofs": [ "4iQ7W7wh6CbCMo5Kc2eoT8Tp9E6mYNVpSSHze3ZfnorD59u1Wk1udmCU9D2nnxrWmCgTZA91JhkGUgtXsb3pyKJw" ], "script": null, "height": 2863083, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EatEHTQMYoNiBQAM7noFnapu8K2SmDops32UKzyiPeJg Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let pool_liquidity_address = "3N4wBgYtWgJW2LTRef2ekWQTrEXCRfXmGLh"
5-
6-let Dapp_Address_pub_key = base58'EXLfxKmqhQPiProBaoPatTentUSZX5Dd8A8bYDcmfNwt'
7-
8-let product_launch_timestamp = 1695427860000
9-
10-let Currency_ID = "WAVES"
11-
12-let product_launch_error = "Product Launch Timestamp is set at "
13-
14-let no_payment_error = "No payment attached, Please Attach Token in payment[1]."
15-
16-let closed_oracle_eror = "Oracle is closed. Wait Until Oracle is Turned On."
17-
18-let whitelist_address = addressFromPublicKey(Dapp_Address_pub_key)
19-
20-let d2dcaller = addressFromPublicKey(base58'6oay51Q6zPcFP9bSwUC4Potx2KGyD4AUjpL5uLR4QeRN')
21-
22-let network_fee = 900000
23-
24-let minimum_order_size = 10000000
25-
26-let maximum_order_size = 10000000000
27-
28-@Callable(i)
29-func placeoptionCall (Amount,OptionCounterID,User_ID,User_Address,Price,Call_Limits,Put_Limits,Oracle_Status,Start_Order_Timestamp,End_Order_Timestamp) = {
30- let calleraddress = toBase58String(i.caller.bytes)
31- let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + User_Address))
32- let read_TPL = valueOrErrorMessage(getInteger(addressFromStringValue(pool_liquidity_address), "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.")
33- let read_user_funds = getIntegerValue(((Currency_ID + "_") + User_Address))
34- let update_user_funds = ((read_user_funds - Amount) - network_fee)
35- let read_start_order_permit_timestamp = Start_Order_Timestamp
36- let read_end_order_permit_timestamp = End_Order_Timestamp
37- let read_OptionCounterID = OptionCounterID
38- let OpionExpireCounter = 1
39- let OptionExpireCounterID = (read_OptionCounterID + OpionExpireCounter)
40- let PreviousOptionOrders = match getInteger(this, "Total_Option_Orders") {
41- case a: Int =>
42- a
43- case _ =>
44- 0
45- }
46- let TotalOptionOrders = (PreviousOptionOrders + 1)
47- let PreviousFundsAddedInSpecificOptionOrder = match getInteger(this, ("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID))) {
48- case a: Int =>
49- a
50- case _ =>
51- 0
52- }
53- let TotalFundsAddedInSpecificOptionOrder = (PreviousFundsAddedInSpecificOptionOrder + Amount)
54- let PreviousOptionOrdersinSpecificCounter = match getInteger(this, ("Total_Option_Orders_" + toString(read_OptionCounterID))) {
55- case a: Int =>
56- a
57- case _ =>
58- 0
59- }
60- let TotalOptionOrdersinSpecificCounter = (PreviousOptionOrdersinSpecificCounter + 1)
61- let PreviousCall = match getInteger(this, "Total_Calls") {
62- case a: Int =>
63- a
64- case _ =>
65- 0
66- }
67- let TotalCall = (PreviousCall + 1)
68- let PreviousCallinSpecificCounter = match getInteger(this, ("Total_Calls_" + toString(read_OptionCounterID))) {
69- case a: Int =>
70- a
71- case _ =>
72- 0
73- }
74- let TotalCallinSpecificCounter = (PreviousCallinSpecificCounter + 1)
75- let PreviousUserCall = match getInteger(this, (User_Address + "_Total_Calls")) {
76- case a: Int =>
77- a
78- case _ =>
79- 0
80- }
81- let TotalUserCall = (PreviousUserCall + 1)
82- let PreviousUserCallinSpecificCounter = match getInteger(this, ((User_Address + "_Total_Calls_") + toString(read_OptionCounterID))) {
83- case a: Int =>
84- a
85- case _ =>
86- 0
87- }
88- let TotalUserCallinSpecificCounter = (PreviousUserCallinSpecificCounter + 1)
89- let Funds_at_risk = fraction(read_TPL, 5, 100)
90- if (if ((i.caller != whitelist_address))
91- then (i.caller != d2dcaller)
92- else false)
93- then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it."))
94- else if ((product_launch_timestamp > lastBlock.timestamp))
95- then throw((product_launch_error + toString(product_launch_timestamp)))
96- else if ((Oracle_Status == "CLOSE"))
97- then throw(closed_oracle_eror)
98- else if ((ifBlacklisted == "Yes"))
99- then throw((User_Address + " Address is Blacklisted. Please contact Admin to Whitelist it."))
100- else if ((lastBlock.timestamp >= read_end_order_permit_timestamp))
101- then throw("Option Order placing Timing Limits are Over. Please Join in Next Cycle.")
102- else if ((TotalFundsAddedInSpecificOptionOrder > Funds_at_risk))
103- 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."))
104- else if ((minimum_order_size > Amount))
105- then throw((("Placed Order Size is less than [" + toString(minimum_order_size)) + "/10^8] WAVES."))
106- else if ((Amount > maximum_order_size))
107- then throw((("Placed Order Size is more than [" + toString(maximum_order_size)) + "/10^8] WAVES."))
108- else if ((0 > update_user_funds))
109- then throw(("Placed Order Amount is going negative. Please reduce the Order Size. Negative Fund Amount = " + toString(update_user_funds)))
110- else if ((size(toString(Start_Order_Timestamp)) != 13))
111- then throw("Start Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.")
112- else if ((size(toString(End_Order_Timestamp)) != 13))
113- then throw("End Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.")
114- 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)]
115- }
116-
117-
118-
119-@Callable(i)
120-func placeoptionPut (Amount,OptionCounterID,User_ID,User_Address,Price,Call_Limits,Put_Limits,Oracle_Status,Start_Order_Timestamp,End_Order_Timestamp) = {
121- let calleraddress = toBase58String(i.caller.bytes)
122- let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + User_Address))
123- let read_TPL = valueOrErrorMessage(getInteger(addressFromStringValue(pool_liquidity_address), "Total_Pool_Liquidity"), "No Initial Pool Liquidity was Found.")
124- let read_user_funds = getIntegerValue(((Currency_ID + "_") + User_Address))
125- let update_user_funds = ((read_user_funds - Amount) - network_fee)
126- let read_start_order_permit_timestamp = Start_Order_Timestamp
127- let read_end_order_permit_timestamp = End_Order_Timestamp
128- let read_OptionCounterID = OptionCounterID
129- let OpionExpireCounter = 1
130- let OptionExpireCounterID = (read_OptionCounterID + OpionExpireCounter)
131- let PreviousOptionOrders = match getInteger(this, "Total_Option_Orders") {
132- case a: Int =>
133- a
134- case _ =>
135- 0
136- }
137- let TotalOptionOrders = (PreviousOptionOrders + 1)
138- let PreviousFundsAddedInSpecificOptionOrder = match getInteger(this, ("Total_Funds_Added_In_Option_Order_" + toString(read_OptionCounterID))) {
139- case a: Int =>
140- a
141- case _ =>
142- 0
143- }
144- let TotalFundsAddedInSpecificOptionOrder = (PreviousFundsAddedInSpecificOptionOrder + Amount)
145- let PreviousOptionOrdersinSpecificCounter = match getInteger(this, ("Total_Option_Orders_" + toString(read_OptionCounterID))) {
146- case a: Int =>
147- a
148- case _ =>
149- 0
150- }
151- let TotalOptionOrdersinSpecificCounter = (PreviousOptionOrdersinSpecificCounter + 1)
152- let PreviousPut = match getInteger(this, "Total_Puts") {
153- case a: Int =>
154- a
155- case _ =>
156- 0
157- }
158- let TotalPut = (PreviousPut + 1)
159- let PreviousPutinSpecificCounter = match getInteger(this, ("Total_Puts_" + toString(read_OptionCounterID))) {
160- case a: Int =>
161- a
162- case _ =>
163- 0
164- }
165- let TotalPutinSpecificCounter = (PreviousPutinSpecificCounter + 1)
166- let PreviousUserPut = match getInteger(this, (User_Address + "_Total_Puts")) {
167- case a: Int =>
168- a
169- case _ =>
170- 0
171- }
172- let TotalUserPut = (PreviousUserPut + 1)
173- let PreviousUserPutinSpecificCounter = match getInteger(this, ((User_Address + "_Total_Puts_") + toString(read_OptionCounterID))) {
174- case a: Int =>
175- a
176- case _ =>
177- 0
178- }
179- let TotalUserPutinSpecificCounter = (PreviousUserPutinSpecificCounter + 1)
180- let Funds_at_risk = fraction(read_TPL, 5, 100)
181- if ((i.caller != whitelist_address))
182- then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it."))
183- else if ((product_launch_timestamp > lastBlock.timestamp))
184- then throw((product_launch_error + toString(product_launch_timestamp)))
185- else if ((Oracle_Status == "CLOSE"))
186- then throw(closed_oracle_eror)
187- else if ((ifBlacklisted == "Yes"))
188- then throw((User_Address + " Address is Blacklisted. Please contact Admin to Whitelist it."))
189- else if ((lastBlock.timestamp >= read_end_order_permit_timestamp))
190- then throw("Option Order placing Timing Limits are Over. Please Join in Next Cycle.")
191- else if ((TotalFundsAddedInSpecificOptionOrder > Funds_at_risk))
192- 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."))
193- else if ((minimum_order_size > Amount))
194- then throw((("Placed Order Size is less than [" + toString(minimum_order_size)) + "/10^8] WAVES."))
195- else if ((Amount > maximum_order_size))
196- then throw((("Placed Order Size is more than [" + toString(maximum_order_size)) + "/10^8] WAVES."))
197- else if ((0 > update_user_funds))
198- then throw(("Placed Order Amount is going negative. Please reduce the Order Size. Negative Fund Amount = " + toString(update_user_funds)))
199- else if ((size(toString(Start_Order_Timestamp)) != 13))
200- then throw("Start Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.")
201- else if ((size(toString(End_Order_Timestamp)) != 13))
202- then throw("End Timestamp is Wrong. Please Enter a Valid Timestamp. Probably you entered an Timestamp less than 13 Chars.")
203- 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)]
204- }
205-
206-
207-
208-@Callable(i)
209-func DepositUserFunds () = {
210- let calleraddress = toBase58String(i.caller.bytes)
211- let pmt = if ((size(i.payments) == 1))
212- then i.payments[0]
213- else throw("No payment attached, Please Attach only Whitelisted Tokens in payment[1].")
214- let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + calleraddress))
215- let PreviousUserDeposit = match getInteger(this, ((Currency_ID + "_") + calleraddress)) {
216- case a: Int =>
217- a
218- case _ =>
219- 0
220- }
221- let TotalUserDeposit = (PreviousUserDeposit + pmt.amount)
222- let PreviousDepositCounterID = match getInteger(this, "Deposit_Counter_ID") {
223- case a: Int =>
224- a
225- case _ =>
226- 0
227- }
228- let TotalDepositCounterID = (PreviousDepositCounterID + 1)
229- if ((product_launch_timestamp > lastBlock.timestamp))
230- then throw((product_launch_error + toString(product_launch_timestamp)))
231- else if ((ifBlacklisted == "Yes"))
232- then throw((calleraddress + " Address is Blacklisted. Please contact Admin to Whitelist it."))
233- else if (isDefined(pmt.assetId))
234- then throw("Only WAVES is allowed to deposit at the moment")
235- else [IntegerEntry(((Currency_ID + "_") + calleraddress), TotalUserDeposit), IntegerEntry(((((toString(TotalDepositCounterID) + "_") + Currency_ID) + "_") + calleraddress), pmt.amount), IntegerEntry("Deposit_Counter_ID", TotalDepositCounterID)]
236- }
237-
238-
239-
240-@Callable(i)
241-func WithdrawUserFunds (User_Address,Amount) = {
242- let calleraddress = toBase58String(i.caller.bytes)
243- let readuserbalance = getIntegerValue(((Currency_ID + "_") + User_Address))
244- let update_user_funds = ((readuserbalance - Amount) - network_fee)
245- let minimim_withdraw_amount = 10000000
246- if ((i.caller != whitelist_address))
247- then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it."))
248- else if ((minimim_withdraw_amount > Amount))
249- then throw((("Minimum Withdraw Amount is " + toString(minimim_withdraw_amount)) + "/10^8] WAVES."))
250- else if ((0 > update_user_funds))
251- then throw((("Placed Withdraw Amount is going in negative State of " + toString(update_user_funds)) + "/10^8] WAVES."))
252- 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)]
253- }
254-
255-
256-
257-@Callable(i)
258-func BlackListAddress (UserAddress) = {
259- let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + UserAddress))
260- let PreviousBlackListAddress = match getInteger(this, "Total_Black_Listed_Address") {
261- case a: Int =>
262- a
263- case _ =>
264- 0
265- }
266- let TotalBlackListAddress = (PreviousBlackListAddress + 1)
267- if ((product_launch_timestamp > lastBlock.timestamp))
268- then throw((product_launch_error + toString(product_launch_timestamp)))
269- else 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 ((ifBlacklisted == "Yes"))
272- then throw("Address is already available in Blacklist.")
273- else [StringEntry(("addr_BLACKLISTED_" + UserAddress), "Yes"), IntegerEntry("Total_Black_Listed_Address", TotalBlackListAddress)]
274- }
275-
276-
277-
278-@Callable(i)
279-func DeleteBlackListAddress (UserAddress) = {
280- let ifBlacklisted = getString(this, ("addr_BLACKLISTED_" + UserAddress))
281- let PreviousBlackListAddress = match getInteger(this, "Total_Black_Listed_Address") {
282- case a: Int =>
283- a
284- case _ =>
285- 0
286- }
287- let TotalBlackListAddress = (PreviousBlackListAddress - 1)
288- if ((product_launch_timestamp > lastBlock.timestamp))
289- then throw(("Product Launch Timestamp is set at " + toString(product_launch_timestamp)))
290- else if ((i.caller != whitelist_address))
291- then throw((("This Address is not Authorized. Only " + toString(whitelist_address)) + " is Authorized Address to Sign it."))
292- else if ((ifBlacklisted == "Yes"))
293- then [DeleteEntry(("addr_BLACKLISTED_" + UserAddress)), IntegerEntry("Total_Black_Listed_Address", TotalBlackListAddress)]
294- else throw("Address is not available in Blacklist.")
295- }
296-
297-
298-@Verifier(tx)
299-func verify () = match tx {
300- case t: Order|ExchangeTransaction|MassTransferTransaction|TransferTransaction =>
301- false
302- case _ =>
303- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
304-}
305-
1+# no script

github/deemru/w8io/026f985 
37.56 ms