tx · FFDt51UGQUxwE3127Cu5DhPAigdsPYuibeSofwCzwexu 3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa: -0.01400000 Waves 2024.07.04 07:52 [3178994] smart account 3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa > SELF 0.00000000 Waves
{ "type": 13, "id": "FFDt51UGQUxwE3127Cu5DhPAigdsPYuibeSofwCzwexu", "fee": 1400000, "feeAssetId": null, "timestamp": 1720079551957, "version": 2, "chainId": 84, "sender": "3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa", "senderPublicKey": "tinwq3CCsobvKT9fhHjTjbxXQdTDmXW9KtgPvR94m1H", "proofs": [ "gqoPxZ1ugnkEcbAQ5wUY9tFMFubCoS8jieGnQpVqjBPtDvM7gTiZ1xfeowCGfv9MUa99gWTNTXMbmZM8WCbSxzw" ], "script": "base64:BwJFCAISBAoCCAgSBQoDCAgIEgcKBQgICAgIEgUKAwgICBIJCgcICAgICAgIEgUKAwgICBIGCgQICAgIEgUKAwgICBIDCgEIIgAJU0VQQVJBVE9SAgJfXwAMS0VZX01VTFRJU0lHAghNVUxUSVNJRwAKS0VZX1NUQVRVUwIGU1RBVFVTAAhLRVlfSU5JVAIESU5JVAAUS0VZX0dBVEVXQVlfQ09OVFJBQ1QCEEdBVEVXQVlfQ09OVFJBQ1QAFEtFWV9NQVRDSEVSX0NPTlRSQUNUAhBNQVRDSEVSX0NPTlRSQUNUABBLRVlfVVNFUl9CQUxBTkNFAgxVU0VSX0JBTEFOQ0UAEUtFWV9UT1RBTF9CQUxBTkNFAg1UT1RBTF9CQUxBTkNFAAtTUE9UX1dBTExFVAIEU1BPVAASV0lUSERSQVdBTFNfV0FMTEVUAgtXSVRIRFJBV0FMUwAVU1RBS0lOR19SRVdBUkRfV0FMTEVUAg5TVEFLSU5HX1JFV0FSRAALWkVST19CSUdJTlQJALYCAQAAARBfdmFsaWRhdGVBZGRyZXNzAghhZGRyZXNzXwRlcnJfBAckbWF0Y2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VElTSUcDCQABAgUHJG1hdGNoMQIGU3RyaW5nBAhtdWx0aXNpZwUHJG1hdGNoMQkBC3ZhbHVlT3JFbHNlAgkAmwgCCQERQGV4dHJOYXRpdmUoMTA2MikBBQhtdWx0aXNpZwkAuQkCCQDMCAIFCktFWV9TVEFUVVMJAMwIAgkApQgBBQR0aGlzCQDMCAIJANgEAQgFAnR4AmlkBQNuaWwFCVNFUEFSQVRPUgcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXn4dCXl", "height": 3178994, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: GvhZNZwcJLxtzaYbjVhyWXqoS27XNkDXay2gKpT7yPTv Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 7 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEPARATOR = "__" | |
5 | + | ||
6 | + | let KEY_MULTISIG = "MULTISIG" | |
7 | + | ||
8 | + | let KEY_STATUS = "STATUS" | |
9 | + | ||
10 | + | let KEY_INIT = "INIT" | |
11 | + | ||
12 | + | let KEY_GATEWAY_CONTRACT = "GATEWAY_CONTRACT" | |
13 | + | ||
14 | + | let KEY_MATCHER_CONTRACT = "MATCHER_CONTRACT" | |
15 | + | ||
16 | + | let KEY_USER_BALANCE = "USER_BALANCE" | |
17 | + | ||
18 | + | let KEY_TOTAL_BALANCE = "TOTAL_BALANCE" | |
19 | + | ||
20 | + | let SPOT_WALLET = "SPOT" | |
21 | + | ||
22 | + | let WITHDRAWALS_WALLET = "WITHDRAWALS" | |
23 | + | ||
24 | + | let STAKING_REWARD_WALLET = "STAKING_REWARD" | |
25 | + | ||
26 | + | let ZERO_BIGINT = toBigInt(0) | |
27 | + | ||
28 | + | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
29 | + | case a: Address => | |
30 | + | true | |
31 | + | case _ => | |
32 | + | throw(err_) | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func _validateBigInt (val_,lowerBoundary_,err_) = if ((lowerBoundary_ > val_)) | |
37 | + | then throw(err_) | |
38 | + | else true | |
39 | + | ||
40 | + | ||
41 | + | func _validateString (val_,err_) = if (if ((0 >= size(val_))) | |
42 | + | then true | |
43 | + | else contains(val_, SEPARATOR)) | |
44 | + | then throw(err_) | |
45 | + | else true | |
46 | + | ||
47 | + | ||
48 | + | func _validateStringEqual (val1_,val2_,err_) = if ((val1_ != val2_)) | |
49 | + | then throw(err_) | |
50 | + | else true | |
51 | + | ||
52 | + | ||
53 | + | func _loadInit () = match getBoolean(KEY_INIT) { | |
54 | + | case a: Boolean => | |
55 | + | a | |
56 | + | case _ => | |
57 | + | false | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
62 | + | ||
63 | + | ||
64 | + | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
65 | + | case a: String => | |
66 | + | addressFromStringValue(a) | |
67 | + | case _ => | |
68 | + | Address(base58'') | |
69 | + | } | |
70 | + | ||
71 | + | ||
72 | + | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
73 | + | ||
74 | + | ||
75 | + | func _loadGatewayContract () = match getString(KEY_GATEWAY_CONTRACT) { | |
76 | + | case a: String => | |
77 | + | addressFromStringValue(a) | |
78 | + | case _ => | |
79 | + | Address(base58'') | |
80 | + | } | |
81 | + | ||
82 | + | ||
83 | + | func _saveGatewayContract (gatewayContract_) = [StringEntry(KEY_GATEWAY_CONTRACT, toString(gatewayContract_))] | |
84 | + | ||
85 | + | ||
86 | + | func _loadMatcherContract () = match getString(KEY_MATCHER_CONTRACT) { | |
87 | + | case a: String => | |
88 | + | addressFromStringValue(a) | |
89 | + | case _ => | |
90 | + | Address(base58'') | |
91 | + | } | |
92 | + | ||
93 | + | ||
94 | + | func _saveMatcherContract (matcherContract_) = [StringEntry(KEY_MATCHER_CONTRACT, toString(matcherContract_))] | |
95 | + | ||
96 | + | ||
97 | + | func _loadUserBalance (user_,wallet_,currency_) = match getString(makeString([KEY_USER_BALANCE, user_, wallet_, currency_], SEPARATOR)) { | |
98 | + | case a: String => | |
99 | + | parseBigIntValue(a) | |
100 | + | case _ => | |
101 | + | ZERO_BIGINT | |
102 | + | } | |
103 | + | ||
104 | + | ||
105 | + | func _saveUserBalance (user_,wallet_,currency_,balance_) = [StringEntry(makeString([KEY_USER_BALANCE, user_, wallet_, currency_], SEPARATOR), toString(balance_))] | |
106 | + | ||
107 | + | ||
108 | + | func _loadTotalBalance (currency_) = match getString(makeString([KEY_TOTAL_BALANCE, currency_], SEPARATOR)) { | |
109 | + | case a: String => | |
110 | + | parseBigIntValue(a) | |
111 | + | case _ => | |
112 | + | ZERO_BIGINT | |
113 | + | } | |
114 | + | ||
115 | + | ||
116 | + | func _saveTotalBalance (currency_,balance_) = [StringEntry(makeString([KEY_TOTAL_BALANCE, currency_], SEPARATOR), toString(balance_))] | |
117 | + | ||
118 | + | ||
119 | + | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
120 | + | then throw("_onlyThisContract: revert") | |
121 | + | else true | |
122 | + | ||
123 | + | ||
124 | + | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
125 | + | then throw("_whenMultisigSet: revert") | |
126 | + | else true | |
127 | + | ||
128 | + | ||
129 | + | func _whenNotInitialized () = if (_loadInit()) | |
130 | + | then throw("_whenNotInitialized: revert") | |
131 | + | else true | |
132 | + | ||
133 | + | ||
134 | + | func _whenInitialized () = if (!(_loadInit())) | |
135 | + | then throw("_whenInitialized: revert") | |
136 | + | else true | |
137 | + | ||
138 | + | ||
139 | + | func _validateGateway (caller,err_) = if ((_loadGatewayContract() != caller)) | |
140 | + | then throw(err_) | |
141 | + | else true | |
142 | + | ||
143 | + | ||
144 | + | func _validateMatcher (caller,err_) = if ((_loadMatcherContract() != caller)) | |
145 | + | then throw(err_) | |
146 | + | else true | |
147 | + | ||
148 | + | ||
149 | + | @Callable(i) | |
150 | + | func init (gatewayContract_,matcherContract_) = { | |
151 | + | let err = if (if (if (if (_onlyThisContract(i.caller)) | |
152 | + | then _whenNotInitialized() | |
153 | + | else false) | |
154 | + | then _whenMultisigSet() | |
155 | + | else false) | |
156 | + | then _validateAddress(gatewayContract_, "init: invalid gatewayContract") | |
157 | + | else false) | |
158 | + | then _validateAddress(matcherContract_, "init: invalid matcherContract") | |
159 | + | else false | |
160 | + | if ((err == err)) | |
161 | + | then $Tuple2(((_saveInit(true) ++ _saveGatewayContract(addressFromStringValue(gatewayContract_))) ++ _saveMatcherContract(addressFromStringValue(matcherContract_))), unit) | |
162 | + | else throw("Strict value is not equal to itself.") | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(i) | |
168 | + | func deposit (user_,currency_,amount_) = { | |
169 | + | let amount = valueOrErrorMessage(parseBigInt(amount_), "deposit: amount not int") | |
170 | + | let err = if (if (if (if (_whenInitialized()) | |
171 | + | then _validateString(user_, "deposit: invalid user") | |
172 | + | else false) | |
173 | + | then _validateString(currency_, "deposit: invalid currency") | |
174 | + | else false) | |
175 | + | then _validateBigInt(amount, ZERO_BIGINT, "deposit: invalid amount") | |
176 | + | else false) | |
177 | + | then _validateGateway(i.caller, "deposit: invalid caller") | |
178 | + | else false | |
179 | + | if ((err == err)) | |
180 | + | then { | |
181 | + | let userBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
182 | + | $Tuple2((_saveUserBalance(user_, SPOT_WALLET, currency_, (userBalance + amount)) ++ _saveTotalBalance(currency_, (_loadTotalBalance(currency_) + amount))), unit) | |
183 | + | } | |
184 | + | else throw("Strict value is not equal to itself.") | |
185 | + | } | |
186 | + | ||
187 | + | ||
188 | + | ||
189 | + | @Callable(i) | |
190 | + | func internalTransfer (user_,sourceWallet_,targetWallet_,currency_,amount_) = { | |
191 | + | let amount = valueOrErrorMessage(parseBigInt(amount_), "internalTransfer: amount not int") | |
192 | + | let err = if (if (if (if (if (if (_whenInitialized()) | |
193 | + | then _validateString(user_, "internalTransfer: invalid user") | |
194 | + | else false) | |
195 | + | then _validateString(sourceWallet_, "internalTransfer: invalid sourceWallet") | |
196 | + | else false) | |
197 | + | then _validateString(targetWallet_, "internalTransfer: invalid targetWallet") | |
198 | + | else false) | |
199 | + | then _validateString(currency_, "internalTransfer: invalid currency") | |
200 | + | else false) | |
201 | + | then _validateBigInt(amount, ZERO_BIGINT, "internalTransfer: invalid amount") | |
202 | + | else false) | |
203 | + | then if ((targetWallet_ == WITHDRAWALS_WALLET)) | |
204 | + | then _validateGateway(i.caller, "internalTransfer: invalid gw caller") | |
205 | + | else _validateMatcher(i.caller, "internalTransfer: invalid matcher caller") | |
206 | + | else false | |
207 | + | if ((err == err)) | |
208 | + | then { | |
209 | + | let userSourceBalance = _loadUserBalance(user_, sourceWallet_, currency_) | |
210 | + | let userTargetBalance = _loadUserBalance(user_, targetWallet_, currency_) | |
211 | + | let newUserSourceBalance = (userSourceBalance - amount) | |
212 | + | let newUserTargetBalance = (userTargetBalance + amount) | |
213 | + | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "internalTransfer: insufficient amount") | |
214 | + | if ((err1 == err1)) | |
215 | + | then $Tuple2((_saveUserBalance(user_, sourceWallet_, currency_, newUserSourceBalance) ++ _saveUserBalance(user_, targetWallet_, currency_, newUserTargetBalance)), unit) | |
216 | + | else throw("Strict value is not equal to itself.") | |
217 | + | } | |
218 | + | else throw("Strict value is not equal to itself.") | |
219 | + | } | |
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | @Callable(i) | |
224 | + | func withdraw (user_,currency_,amount_) = { | |
225 | + | let amount = valueOrErrorMessage(parseBigInt(amount_), "withdraw: amount not int") | |
226 | + | let err = if (if (if (if (_whenInitialized()) | |
227 | + | then _validateString(user_, "withdraw: invalid user") | |
228 | + | else false) | |
229 | + | then _validateString(currency_, "withdraw: invalid currency") | |
230 | + | else false) | |
231 | + | then _validateBigInt(amount, ZERO_BIGINT, "withdraw: invalid amount") | |
232 | + | else false) | |
233 | + | then _validateGateway(i.caller, "withdraw: invalid caller") | |
234 | + | else false | |
235 | + | if ((err == err)) | |
236 | + | then { | |
237 | + | let userBalance = _loadUserBalance(user_, WITHDRAWALS_WALLET, currency_) | |
238 | + | let newUserBalance = (userBalance - amount) | |
239 | + | let newTotalBalance = (_loadTotalBalance(currency_) - amount) | |
240 | + | let err1 = if (_validateBigInt(newUserBalance, ZERO_BIGINT, "withdraw: insufficient amount")) | |
241 | + | then _validateBigInt(newTotalBalance, ZERO_BIGINT, "withdraw: negative total balance") | |
242 | + | else false | |
243 | + | if ((err1 == err1)) | |
244 | + | then $Tuple2((_saveUserBalance(user_, WITHDRAWALS_WALLET, currency_, newUserBalance) ++ _saveTotalBalance(currency_, newTotalBalance)), unit) | |
245 | + | else throw("Strict value is not equal to itself.") | |
246 | + | } | |
247 | + | else throw("Strict value is not equal to itself.") | |
248 | + | } | |
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | @Callable(i) | |
253 | + | func externalTransfer (wallet_,currency_,from_,to_,amount_,fee_,dex_) = { | |
254 | + | let amount = valueOrErrorMessage(parseBigInt(amount_), "externalTransfer: amount not int") | |
255 | + | let fee = valueOrErrorMessage(parseBigInt(fee_), "externalTransfer: fee not int") | |
256 | + | let err = if (if (if (if (if (if (if (if (_whenInitialized()) | |
257 | + | then _validateString(wallet_, "externalTransfer: invalid wallet") | |
258 | + | else false) | |
259 | + | then _validateString(currency_, "externalTransfer: invalid currency") | |
260 | + | else false) | |
261 | + | then _validateString(from_, "externalTransfer: invalid from") | |
262 | + | else false) | |
263 | + | then _validateString(to_, "externalTransfer: invalid to") | |
264 | + | else false) | |
265 | + | then _validateBigInt(amount, ZERO_BIGINT, "externalTransfer: invalid amount") | |
266 | + | else false) | |
267 | + | then _validateBigInt(fee, ZERO_BIGINT, "externalTransfer: invalid fee") | |
268 | + | else false) | |
269 | + | then _validateString(dex_, "externalTransfer: invalid dex") | |
270 | + | else false) | |
271 | + | then _validateMatcher(i.caller, "externalTransfer: invalid matcher caller") | |
272 | + | else false | |
273 | + | if ((err == err)) | |
274 | + | then { | |
275 | + | let userSourceBalance = _loadUserBalance(from_, wallet_, currency_) | |
276 | + | let userTargetBalance = _loadUserBalance(to_, wallet_, currency_) | |
277 | + | let dexTargetBalance = _loadUserBalance(dex_, wallet_, currency_) | |
278 | + | let newUserSourceBalance = ((userSourceBalance - amount) - fee) | |
279 | + | let newUserTargetBalance = (userTargetBalance + amount) | |
280 | + | let newDexTargetBalance = (dexTargetBalance + fee) | |
281 | + | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "externalTransfer: insufficient amount") | |
282 | + | if ((err1 == err1)) | |
283 | + | then $Tuple2(((_saveUserBalance(from_, wallet_, currency_, newUserSourceBalance) ++ _saveUserBalance(to_, wallet_, currency_, newUserTargetBalance)) ++ _saveUserBalance(dex_, wallet_, currency_, newDexTargetBalance)), unit) | |
284 | + | else throw("Strict value is not equal to itself.") | |
285 | + | } | |
286 | + | else throw("Strict value is not equal to itself.") | |
287 | + | } | |
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | @Callable(i) | |
292 | + | func depositStakingReward (dex_,currency_,amount_) = { | |
293 | + | let amount = valueOrErrorMessage(parseBigInt(amount_), "depositStakingReward: amount not int") | |
294 | + | let err = if (if (if (if (_whenInitialized()) | |
295 | + | then _validateString(dex_, "depositStakingReward: invalid dex") | |
296 | + | else false) | |
297 | + | then _validateString(currency_, "depositStakingReward: invalid currency") | |
298 | + | else false) | |
299 | + | then _validateBigInt(amount, ZERO_BIGINT, "depositStakingReward: invalid amount") | |
300 | + | else false) | |
301 | + | then _validateGateway(i.caller, "depositStakingReward: invalid caller") | |
302 | + | else false | |
303 | + | if ((err == err)) | |
304 | + | then { | |
305 | + | let userBalance = _loadUserBalance(dex_, STAKING_REWARD_WALLET, currency_) | |
306 | + | $Tuple2((_saveUserBalance(dex_, STAKING_REWARD_WALLET, currency_, (userBalance + amount)) ++ _saveTotalBalance(currency_, (_loadTotalBalance(currency_) + amount))), unit) | |
307 | + | } | |
308 | + | else throw("Strict value is not equal to itself.") | |
309 | + | } | |
310 | + | ||
311 | + | ||
312 | + | ||
313 | + | @Callable(i) | |
314 | + | func claimReward (dex_,user_,currency_,amount_) = { | |
315 | + | let amount = valueOrErrorMessage(parseBigInt(amount_), "claimReward: amount not int") | |
316 | + | let err = if (if (if (if (if (_whenInitialized()) | |
317 | + | then _validateString(dex_, "claimReward: invalid dex") | |
318 | + | else false) | |
319 | + | then _validateString(user_, "claimReward: invalid user") | |
320 | + | else false) | |
321 | + | then _validateString(currency_, "claimReward: invalid currency") | |
322 | + | else false) | |
323 | + | then _validateBigInt(amount, ZERO_BIGINT, "claimReward: invalid amount") | |
324 | + | else false) | |
325 | + | then _validateMatcher(i.caller, "claimReward: invalid matcher caller") | |
326 | + | else false | |
327 | + | if ((err == err)) | |
328 | + | then { | |
329 | + | let dexSourceBalance = _loadUserBalance(dex_, STAKING_REWARD_WALLET, currency_) | |
330 | + | let userTargetBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
331 | + | let newDexSourceBalance = (dexSourceBalance - amount) | |
332 | + | let newUserTargetBalance = (userTargetBalance + amount) | |
333 | + | let err1 = _validateBigInt(newDexSourceBalance, ZERO_BIGINT, "claimReward: insufficient amount") | |
334 | + | if ((err1 == err1)) | |
335 | + | then $Tuple2((_saveUserBalance(dex_, STAKING_REWARD_WALLET, currency_, newDexSourceBalance) ++ _saveUserBalance(user_, SPOT_WALLET, currency_, newUserTargetBalance)), unit) | |
336 | + | else throw("Strict value is not equal to itself.") | |
337 | + | } | |
338 | + | else throw("Strict value is not equal to itself.") | |
339 | + | } | |
340 | + | ||
341 | + | ||
342 | + | ||
343 | + | @Callable(i) | |
344 | + | func getUserBalance (user_,wallet_,currency_) = $Tuple2(nil, toString(_loadUserBalance(user_, wallet_, currency_))) | |
345 | + | ||
346 | + | ||
347 | + | ||
348 | + | @Callable(i) | |
349 | + | func setMultisig (multisig_) = { | |
350 | + | let err = if (_onlyThisContract(i.caller)) | |
351 | + | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
352 | + | else false | |
353 | + | if ((err == err)) | |
354 | + | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
355 | + | else throw("Strict value is not equal to itself.") | |
356 | + | } | |
357 | + | ||
358 | + | ||
359 | + | @Verifier(tx) | |
360 | + | func verify () = match tx { | |
361 | + | case _ => | |
362 | + | match getString(KEY_MULTISIG) { | |
363 | + | case multisig: String => | |
364 | + | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
365 | + | case _ => | |
366 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
367 | + | } | |
368 | + | } | |
369 | + |
github/deemru/w8io/169f3d6 21.80 ms ◑