tx · CuCnjNQ5ZDqV6Tbow1sWCfQpPgwyZS4B8TaVVYQSTeCf

3MwoWxBwFKxjUKK53Rxbnwrs8m2MsVMPPa7:  -0.01000000 Waves

2023.11.28 11:29 [2863008] smart account 3MwoWxBwFKxjUKK53Rxbnwrs8m2MsVMPPa7 > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
46.64 ms