tx · Dqf4N925hWDVBJfm7van6x6mcSn6Ps2dCQjtm3mUWP94

3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD:  -0.00700000 Waves

2022.08.27 23:14 [2203350] smart account 3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD > SELF 0.00000000 Waves

{ "type": 13, "id": "Dqf4N925hWDVBJfm7van6x6mcSn6Ps2dCQjtm3mUWP94", "fee": 700000, "feeAssetId": null, "timestamp": 1661631353734, "version": 2, "chainId": 84, "sender": "3MzwNdM8LQZEPXq3d4uXvxeZGpBwVQXs9RD", "senderPublicKey": "G4H6mB4yX5B1YAf6cKk4TteRS3NbLVrZ2i45DJGqqwLV", "proofs": [ "4yN8dzT2ctFjmGKASPo4Exq6hyz2qPiwTR6TiqEaLipj9bNXeNdb9kopybrU5jziGSrm7VCFGkobQpaoWf4YEeiq" ], "script": "base64:BgIYCAISABIAEgMKAQESAwoBARIAEgASABIABgAEdXNkbgEg11KRGPRfT6VehNuJvBkobHB7OMalzc+gLp7N2ofv42AABHVzZGMBIPQcuTcYg4l4Uh6IaJaLWyiuNgmUbeQfgPZEel3eCXgMAAxhZG1pbl93YWxsZXQCIzNOM0RDbmdqaWRpdmtKYlRKd0ZURXZiWVJUZmZDV1ZCTENMAA5hbGZhcmtfdGVzdG5ldAAFAAp2aXJlc19kYXBwARoBVHjn3floRCovnhXY1SHCQGibEg7rsYrFrAENdHJ5R2V0SW50ZWdlcgEDa2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtYXRjaDAFAWIAAAgBaQEPYnV5X3VzZG5fdGlja2V0AAMJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAUEdXNkbgkAAgECH1BsZWFzZSBkZXBvc2l0IFVTRC1OIHRva2VuIG9ubHkEC3VzZXJfY3JlZGl0CQENdHJ5R2V0SW50ZWdlcgEJAKwCAgkArAICAgV1c2RuXwkApQ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QCkAwEJAGUCBQ5hbGZhcmtfdGVzdG5ldAUGYWxmYXJrAgYgYmxvY2sEDHVzZGNfYmFsYW5jZQkA8AcCBQR0aGlzBQR1c2RjCQDMCAIJAQxJbnRlZ2VyRW50cnkCAhZ1c2RjX3Byb2ZpdF9sYXN0X2Jsb2NrBRF0cmFuc2FjdGlvbl9ibG9jawkAzAgCCQEMSW50ZWdlckVudHJ5AgIXdXNkY19wcm9maXRfbGFzdF9hbW91bnQFDHVzZGNfYmFsYW5jZQUDbmlsAWkBF3VzZGNfc2VuZF9wcm9maXRfYW1vdW50AAQXdXNkY19wcm9maXRfbGFzdF9hbW91bnQJAQ10cnlHZXRJbnRlZ2VyAQIXdXNkY19wcm9maXRfbGFzdF9hbW91bnQDCQBnAgAABRd1c2RjX3Byb2ZpdF9sYXN0X2Ftb3VudAkAAgEJAKwCAgIceW91IGRvbnQgaGF2ZSBwcm9maXQgYW1vdW50IAkApAMBBRd1c2RjX3Byb2ZpdF9sYXN0X2Ftb3VudAQIdHJhbnNmZXIJAQ5TY3JpcHRUcmFuc2ZlcgMJARFAZXh0ck5hdGl2ZSgxMDYyKQEFDGFkbWluX3dhbGxldAUXdXNkY19wcm9maXRfbGFzdF9hbW91bnQFBHVzZGMJAMwIAgUIdHJhbnNmZXIFA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXktXhFB", "height": 2203350, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 556m3ix8sXWUNEY44juYAKR7TFKG4cd148ZvF3LrSXRm Next: 6qGnkVmysRiMQzjj1KdzFyZ2RiyRfDGgqGZSLES6PDh4 Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let usdN = base58'FVXgJ86erBw5GAMeAw1CnYXwQn48BFAEAhRyHPUjbMQB'
4+let usdn = base58'FVXgJ86erBw5GAMeAw1CnYXwQn48BFAEAhRyHPUjbMQB'
55
6-let usdC = base58'HRut8ESAGXxwvsKJky1V96qRtqyXQd4Apq4GY7TE5yGP'
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+
721
822 @Callable(i)
9-func usdN_stake () = if ((i.payments[0].assetId != usdN))
10- then throw("unexpected asset")
23+func buy_usdn_ticket () = if ((i.payments[0].assetId != usdn))
24+ then throw("Please deposit USD-N token only")
1125 else {
12- let currentLiquidity = valueOrElse(getInteger(this, toString(i.originCaller)), 0)
13-[IntegerEntry(toString(i.originCaller), (currentLiquidity + i.payments[0].amount))]
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.")
1451 }
1552
1653
1754
1855 @Callable(i)
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")
56+func buy_usdc_ticket () = if ((i.payments[0].assetId != usdc))
57+ then throw("Please deposit USD-N token only")
2858 else {
29- let currentLiquidity = valueOrElse(getInteger(this, toString(i.originCaller)), 0)
30-[IntegerEntry(toString(i.originCaller), (currentLiquidity + i.payments[0].amount))]
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.")
3184 }
3285
3386
3487
3588 @Callable(i)
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")
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+ }
39119
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)
40229

github/deemru/w8io/026f985 
28.76 ms