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