tx · 6qGnkVmysRiMQzjj1KdzFyZ2RiyRfDGgqGZSLES6PDh4

3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD:  -0.00200000 Waves

2022.08.27 23:16 [2203351] smart account 3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD > SELF 0.00000000 Waves

{ "type": 13, "id": "6qGnkVmysRiMQzjj1KdzFyZ2RiyRfDGgqGZSLES6PDh4", "fee": 200000, "feeAssetId": null, "timestamp": 1661631414538, "version": 2, "chainId": 84, "sender": "3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD", "senderPublicKey": "G4H6mB4yX5B1YAf6cKk4TteRS3NbLVrZ2i45DJGqqwLV", "proofs": [ "22sqDUBNutnUPyFnPAWFzsgWEimD2xu5rvn1iuUQpDW7Ta3eoCD6rWw1mLd9FzMouGtpaZG1U4QaCyaUGupCDdqp" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgMKAQESABIDCgEBAAAAAgAAAAAEdXNkTgEAAAAg11KRGPRfT6VehNuJvBkobHB7OMalzc+gLp7N2ofv42AAAAAABHVzZEMBAAAAIPQcuTcYg4l4Uh6IaJaLWyiuNgmUbeQfgPZEel3eCXgMAAAABAAAAAFpAQAAAAp1c2ROX3N0YWtlAAAAAAMJAQAAAAIhPQAAAAIICQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAAAAB2Fzc2V0SWQFAAAABHVzZE4JAAACAAAAAQIAAAAQdW5leHBlY3RlZCBhc3NldAQAAAAQY3VycmVudExpcXVpZGl0eQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAR0aGlzCQAEJQAAAAEIBQAAAAFpAAAADG9yaWdpbkNhbGxlcgAAAAAAAAAAAAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkABCUAAAABCAUAAAABaQAAAAxvcmlnaW5DYWxsZXIJAABkAAAAAgUAAAAQY3VycmVudExpcXVpZGl0eQgJAAGR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ZXIAAAADCAUAAAABaQAAAAxvcmlnaW5DYWxsZXIFAAAABmFtb3VudAUAAAAEdXNkQwUAAAADbmlsCQAAAgAAAAECAAAADnRvbyBiaWcgYW1vdW50AAAAAInKjNw=", "height": 2203351, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Dqf4N925hWDVBJfm7van6x6mcSn6Ps2dCQjtm3mUWP94 Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 6 #-}
1+{-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let usdn = base58'FVXgJ86erBw5GAMeAw1CnYXwQn48BFAEAhRyHPUjbMQB'
4+let usdN = base58'FVXgJ86erBw5GAMeAw1CnYXwQn48BFAEAhRyHPUjbMQB'
55
6-let usdc = base58'HRut8ESAGXxwvsKJky1V96qRtqyXQd4Apq4GY7TE5yGP'
7-
8-let admin_wallet = "3N3DCngjidivkJbTJwFTEvbYRTffCWVBLCL"
9-
10-let alfark_testnet = 5
11-
12-let vires_dapp = base58'3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD'
13-
14-func tryGetInteger (key) = match getInteger(this, key) {
15- case b: Int =>
16- b
17- case _ =>
18- 0
19-}
20-
6+let usdC = base58'HRut8ESAGXxwvsKJky1V96qRtqyXQd4Apq4GY7TE5yGP'
217
228 @Callable(i)
23-func buy_usdn_ticket () = if ((i.payments[0].assetId != usdn))
24- then throw("Please deposit USD-N token only")
9+func usdN_stake () = if ((i.payments[0].assetId != usdN))
10+ then throw("unexpected asset")
2511 else {
26- let user_credit = tryGetInteger((("usdn_" + toString(i.originCaller)) + "_credit"))
27- let deposit_amount = i.payments[0].amount
28- let new_user_credit = (user_credit + deposit_amount)
29- let all_credit = tryGetInteger("usdn_all_credit")
30- let new_all_credit = (all_credit + deposit_amount)
31- let transaction_block = match transactionHeightById(i.transactionId) {
32- case a: Int =>
33- a
34- case _ =>
35- throw("Error block number")
36- }
37- let res = invoke(Address(vires_dapp), "usdN_stake", nil, [AttachedPayment(usdn, deposit_amount)])
38- if ((res == res))
39- then {
40- let vires_res = match res {
41- case r: List[Any] =>
42- r
43- case _ =>
44- throw()
45- }
46- if ((vires_res == vires_res))
47- then [IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)]
48- else throw("Strict value is not equal to itself.")
49- }
50- else throw("Strict value is not equal to itself.")
12+ let currentLiquidity = valueOrElse(getInteger(this, toString(i.originCaller)), 0)
13+[IntegerEntry(toString(i.originCaller), (currentLiquidity + i.payments[0].amount))]
5114 }
5215
5316
5417
5518 @Callable(i)
56-func buy_usdc_ticket () = if ((i.payments[0].assetId != usdc))
57- then throw("Please deposit USD-N token only")
19+func usdN_cancelStake (amount) = if ((getIntegerValue(this, toString(i.originCaller)) >= amount))
20+ then [ScriptTransfer(i.originCaller, amount, usdN)]
21+ else throw("too big amount")
22+
23+
24+
25+@Callable(i)
26+func usdC_stake () = if ((i.payments[0].assetId != usdC))
27+ then throw("unexpected asset")
5828 else {
59- let user_credit = tryGetInteger((("usdc_" + toString(i.originCaller)) + "_credit"))
60- let deposit_amount = i.payments[0].amount
61- let new_user_credit = (user_credit + deposit_amount)
62- let all_credit = tryGetInteger("usdc_all_credit")
63- let new_all_credit = (all_credit + deposit_amount)
64- let transaction_block = match transactionHeightById(i.transactionId) {
65- case a: Int =>
66- a
67- case _ =>
68- throw("Error block number")
69- }
70- let res = invoke(Address(vires_dapp), "usdC_stake", nil, [AttachedPayment(usdc, deposit_amount)])
71- if ((res == res))
72- then {
73- let vires_res = match res {
74- case r: List[Any] =>
75- r
76- case _ =>
77- throw("Incorrect invoke result")
78- }
79- if ((vires_res == vires_res))
80- then [IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)]
81- else throw("Strict value is not equal to itself.")
82- }
83- else throw("Strict value is not equal to itself.")
29+ let currentLiquidity = valueOrElse(getInteger(this, toString(i.originCaller)), 0)
30+[IntegerEntry(toString(i.originCaller), (currentLiquidity + i.payments[0].amount))]
8431 }
8532
8633
8734
8835 @Callable(i)
89-func sell_usdn_ticket (amount) = {
90- let user_credit = tryGetInteger((("usdn_" + toString(i.originCaller)) + "_credit"))
91- if ((amount > user_credit))
92- then throw(("sorry you can't withdraw this amount, because u=you have only " + toString(user_credit)))
93- else {
94- let new_user_credit = (user_credit - amount)
95- let all_credit = tryGetInteger("usdn_all_credit")
96- let new_all_credit = (all_credit - amount)
97- let transaction_block = match transactionHeightById(i.transactionId) {
98- case a: Int =>
99- a
100- case _ =>
101- throw("Error block number")
102- }
103- let res = invoke(Address(vires_dapp), "usdN_cancelStake", [amount], nil)
104- if ((res == res))
105- then {
106- let vires_res = match res {
107- case r: List[Any] =>
108- r
109- case _ =>
110- throw("Incorrect invoke result")
111- }
112- if ((vires_res == vires_res))
113- then [IntegerEntry((("usdn_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdn_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdn_all_credit", new_all_credit), IntegerEntry("usdn_all_block", transaction_block)]
114- else throw("Strict value is not equal to itself.")
115- }
116- else throw("Strict value is not equal to itself.")
117- }
118- }
36+func usdC_cancelStake (amount) = if ((getIntegerValue(this, toString(i.originCaller)) >= amount))
37+ then [ScriptTransfer(i.originCaller, amount, usdC)]
38+ else throw("too big amount")
11939
120-
121-
122-@Callable(i)
123-func sell_usdc_ticket (amount) = {
124- let user_credit = tryGetInteger((("usdc_" + toString(i.originCaller)) + "_credit"))
125- if ((amount > user_credit))
126- then throw(("sorry you can't withdraw this amount, because u=you have only " + toString(user_credit)))
127- else {
128- let new_user_credit = (user_credit - amount)
129- let all_credit = tryGetInteger("usdc_all_credit")
130- let new_all_credit = (all_credit - amount)
131- let transaction_block = match transactionHeightById(i.transactionId) {
132- case a: Int =>
133- a
134- case _ =>
135- throw("Error block number")
136- }
137- let res = invoke(Address(vires_dapp), "usdC_cancelStake", [amount], nil)
138- if ((res == res))
139- then {
140- let vires_res = match res {
141- case r: List[Any] =>
142- r
143- case _ =>
144- throw("Incorrect invoke result")
145- }
146- if ((vires_res == vires_res))
147- then [IntegerEntry((("usdc_" + toString(i.originCaller)) + "_credit"), new_user_credit), IntegerEntry((("usdc_" + toString(i.originCaller)) + "_block"), transaction_block), IntegerEntry("usdc_all_credit", new_all_credit), IntegerEntry("usdc_all_block", transaction_block)]
148- else throw("Strict value is not equal to itself.")
149- }
150- else throw("Strict value is not equal to itself.")
151- }
152- }
153-
154-
155-
156-@Callable(i)
157-func usdn_calc_profit_amount () = if ((toString(i.originCaller) != admin_wallet))
158- then throw("Sorry! you are not allowed to use this funaction")
159- else {
160- let usdn_profit_last_block = tryGetInteger("usdn_profit_last_block")
161- let usdn_profit_last_amount = tryGetInteger("usdn_profit_last_amount")
162- let transaction_block = match transactionHeightById(i.transactionId) {
163- case a: Int =>
164- a
165- case _ =>
166- throw("Error block number")
167- }
168- let alfark = (transaction_block - usdn_profit_last_block)
169- if ((alfark_testnet > alfark))
170- then throw((("Please try again after " + toString((alfark_testnet - alfark))) + " block"))
171- else {
172- let usdn_balance = assetBalance(this, usdn)
173-[IntegerEntry("usdn_profit_last_block", transaction_block), IntegerEntry("usdn_profit_last_amount", usdn_balance)]
174- }
175- }
176-
177-
178-
179-@Callable(i)
180-func usdn_send_profit_amount () = {
181- let usdn_profit_last_amount = tryGetInteger("usdn_profit_last_amount")
182- if ((0 >= usdn_profit_last_amount))
183- then throw(("you dont have profit amount " + toString(usdn_profit_last_amount)))
184- else {
185- let transfer = ScriptTransfer(addressFromStringValue(admin_wallet), usdn_profit_last_amount, usdn)
186-[transfer]
187- }
188- }
189-
190-
191-
192-@Callable(i)
193-func usdc_calc_profit_amount () = if ((toString(i.originCaller) != admin_wallet))
194- then throw("Sorry! you are not allowed to use this funaction")
195- else {
196- let usdc_profit_last_block = tryGetInteger("usdc_profit_last_block")
197- let usdc_profit_last_amount = tryGetInteger("usdc_profit_last_amount")
198- let transaction_block = match transactionHeightById(i.transactionId) {
199- case a: Int =>
200- a
201- case _ =>
202- throw("Error block number")
203- }
204- let alfark = (transaction_block - usdc_profit_last_block)
205- if ((alfark_testnet > alfark))
206- then throw((("Please try again after " + toString((alfark_testnet - alfark))) + " block"))
207- else {
208- let usdc_balance = assetBalance(this, usdc)
209-[IntegerEntry("usdc_profit_last_block", transaction_block), IntegerEntry("usdc_profit_last_amount", usdc_balance)]
210- }
211- }
212-
213-
214-
215-@Callable(i)
216-func usdc_send_profit_amount () = {
217- let usdc_profit_last_amount = tryGetInteger("usdc_profit_last_amount")
218- if ((0 >= usdc_profit_last_amount))
219- then throw(("you dont have profit amount " + toString(usdc_profit_last_amount)))
220- else {
221- let transfer = ScriptTransfer(addressFromStringValue(admin_wallet), usdc_profit_last_amount, usdc)
222-[transfer]
223- }
224- }
225-
226-
227-@Verifier(tx)
228-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
22940

github/deemru/w8io/026f985 
28.99 ms