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