tx · 3uJdmYkbWwVbFaNh4BJLywXMi3vfWU4DmTqXD2xJPkvD 3MpiUwTkYopBwQEjyTf8sqy7iWLNwyq9Md4: -0.01800000 Waves 2024.12.10 20:33 [3408807] smart account 3MpiUwTkYopBwQEjyTf8sqy7iWLNwyq9Md4 > SELF 0.00000000 Waves
{ "type": 13, "id": "3uJdmYkbWwVbFaNh4BJLywXMi3vfWU4DmTqXD2xJPkvD", "fee": 1800000, "feeAssetId": null, "timestamp": 1733852015420, "version": 2, "chainId": 84, "sender": "3MpiUwTkYopBwQEjyTf8sqy7iWLNwyq9Md4", "senderPublicKey": "9eCupW2UoCBhmiF1N9qWACCzkWT885DVzb65b8zxcSii", "proofs": [ "5CuWAzBHaUb9EZWvbhLrJBgvXE8roXxMLNk1Zn9jiAy2QSm7KpZWxYXTqnJtv3G3PS61HiBHk7FYJqoKyKotJ9Sk" ], "script": "base64:BwItCAISBQoDCAgIEgYKBAgICAgSBQoDCAgIEgQKAggEEgMKAQgSAwoBCBIDCgEIPwAJU0VQQVJBVE9SAgJfXwAMS0VZX01VTFRJU0lHAghNVUxUSVNJRwAKS0VZX1NUQVRVUwIGU1RBVFVTAAhLRVlfSU5JVAIESU5JVAANS0VZX1NFUVVFTkNFUgIJU0VRVUVOQ0VSABNLRVlfQUNDT1VOVF9TVE9SQUdFAg9BQ0NPVU5UX1NUT1JBR0UAEUtFWV9GRUVfUkVDSVBJRU5UAg1GRUVfUkVDSVBJRU5UAApLRVlfU1lNQk9MAgZTWU1CT0wAF0tFWV9PUkRFUl9GSUxMRURfQU1PVU5UAhNPUkRFUl9GSUxMRURfQU1PVU5UABZLRVlfUkVXQVJEX0RJU1RSSUJVVE9SAhJSRVdBUkRfRElTVFJJQlVUT1IAFkZVTkNfRVhURVJOQUxfVFJBTlNGRVICEGV4dGVybmFsVHJhbnNmZXIAEUZVTkNfQ0xBSU1fUkVXQVJEAgtjbGFpbVJld2FyZAALU1BPVF9XQUxMRVQCBFNQT1QAEE9SREVSX1RZ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mAiydaXNgaW1g8sZxWdzuTFn Next: none Diff:
Old | New | Differences | |
---|---|---|---|
268 | 268 | func _validateOrderSignature (orderHash_,signature_,web3Id_,alg_,err_) = { | |
269 | 269 | let result = if ((alg_ == ALG_TYPE_WAVES)) | |
270 | 270 | then { | |
271 | - | let | |
272 | - | sigVerify( | |
271 | + | let msg = (WAVES_PREFIX + toBytes(toBase58String(orderHash_))) | |
272 | + | sigVerify(msg, signature_, web3Id_) | |
273 | 273 | } | |
274 | 274 | else if ((alg_ == ALG_TYPE_EVM)) | |
275 | 275 | then { | |
298 | 298 | let web3Id = fromBase58String(fields[5]) | |
299 | 299 | let alg = valueOrErrorMessage(parseInt(fields[6]), (err_ + ": inv alg")) | |
300 | 300 | let signature = fromBase58String(fields[7]) | |
301 | - | let $ | |
301 | + | let $t084629500 = if (if ((type == ORDER_TYPE_LIMIT)) | |
302 | 302 | then (version == ORDER_VERSION_1) | |
303 | 303 | else false) | |
304 | 304 | then { | |
320 | 320 | else $Tuple4(ZERO_BIGINT, ZERO_BIGINT, amount, (toBytes(amount) + toBytes(ZERO_BIGINT))) | |
321 | 321 | } | |
322 | 322 | else throw((err_ + ": inv type & version")) | |
323 | - | let price = $ | |
324 | - | let baseAmount = $ | |
325 | - | let quoteAmount = $ | |
326 | - | let orderDetailsBytes = $ | |
323 | + | let price = $t084629500._1 | |
324 | + | let baseAmount = $t084629500._2 | |
325 | + | let quoteAmount = $t084629500._3 | |
326 | + | let orderDetailsBytes = $t084629500._4 | |
327 | 327 | let orderBytes = ((((((((toBytes(type) + toBytes(version)) + toBytes(size(symbol))) + toBytes(symbol)) + toBytes(side)) + toBytes(ts)) + web3Id) + toBytes(alg)) + orderDetailsBytes) | |
328 | 328 | let orderHash = keccak256_32Kb(orderBytes) | |
329 | 329 | let err = if (if (if (if (if (if (if (_validateOrderType(type, version, (err_ + ": inv order type"))) | |
369 | 369 | ||
370 | 370 | @Callable(i) | |
371 | 371 | func trade (makerOrder_,takerOrder_,baseFee_,quoteFee_) = { | |
372 | - | let $ | |
373 | - | let makerOrderType = $ | |
374 | - | let makerOrderSymbol = $ | |
375 | - | let makerOrderSide = $ | |
376 | - | let makerOrderPrice = $ | |
377 | - | let makerOrderBaseAmount = $ | |
378 | - | let makerOrderQuoteAmount = $ | |
379 | - | let makerOrderHash = $ | |
380 | - | let makerOrderWeb3Id = $ | |
381 | - | let makerOrderAlg = $ | |
382 | - | let makerOrderSignature = $ | |
383 | - | let $ | |
384 | - | let takerOrderType = $ | |
385 | - | let takerOrderSymbol = $ | |
386 | - | let takerOrderSide = $ | |
387 | - | let takerOrderPrice = $ | |
388 | - | let takerOrderBaseAmount = $ | |
389 | - | let takerOrderQuoteAmount = $ | |
390 | - | let takerOrderHash = $ | |
391 | - | let takerOrderWeb3Id = $ | |
392 | - | let takerOrderAlg = $ | |
393 | - | let takerOrderSignature = $ | |
372 | + | let $t01131611645 = _parseOrder(makerOrder_, "trade: invalid maker order") | |
373 | + | let makerOrderType = $t01131611645._1 | |
374 | + | let makerOrderSymbol = $t01131611645._2 | |
375 | + | let makerOrderSide = $t01131611645._3 | |
376 | + | let makerOrderPrice = $t01131611645._4 | |
377 | + | let makerOrderBaseAmount = $t01131611645._5 | |
378 | + | let makerOrderQuoteAmount = $t01131611645._6 | |
379 | + | let makerOrderHash = $t01131611645._7 | |
380 | + | let makerOrderWeb3Id = $t01131611645._8 | |
381 | + | let makerOrderAlg = $t01131611645._9 | |
382 | + | let makerOrderSignature = $t01131611645._10 | |
383 | + | let $t01165111980 = _parseOrder(takerOrder_, "trade: invalid taker order") | |
384 | + | let takerOrderType = $t01165111980._1 | |
385 | + | let takerOrderSymbol = $t01165111980._2 | |
386 | + | let takerOrderSide = $t01165111980._3 | |
387 | + | let takerOrderPrice = $t01165111980._4 | |
388 | + | let takerOrderBaseAmount = $t01165111980._5 | |
389 | + | let takerOrderQuoteAmount = $t01165111980._6 | |
390 | + | let takerOrderHash = $t01165111980._7 | |
391 | + | let takerOrderWeb3Id = $t01165111980._8 | |
392 | + | let takerOrderAlg = $t01165111980._9 | |
393 | + | let takerOrderSignature = $t01165111980._10 | |
394 | 394 | let baseFee = valueOrErrorMessage(parseBigInt(baseFee_), "trade: baseFee not int") | |
395 | 395 | let quoteFee = valueOrErrorMessage(parseBigInt(quoteFee_), "trade: quoteFee not int") | |
396 | 396 | let tradePrice = makerOrderPrice | |
425 | 425 | then { | |
426 | 426 | let makerAddress = _convertWeb3IdToAddress(makerOrderWeb3Id, makerOrderAlg) | |
427 | 427 | let takerAddress = _convertWeb3IdToAddress(takerOrderWeb3Id, takerOrderAlg) | |
428 | - | let $ | |
428 | + | let $t01413714560 = if ((makerOrderSide == ORDER_SIDE_BUY)) | |
429 | 429 | then $Tuple2(makerAddress, takerAddress) | |
430 | 430 | else $Tuple2(takerAddress, makerAddress) | |
431 | - | let buyer = $ | |
432 | - | let seller = $ | |
431 | + | let buyer = $t01413714560._1 | |
432 | + | let seller = $t01413714560._2 | |
433 | 433 | let assets = split(makerOrderSymbol, "-") | |
434 | 434 | let baseAsset = assets[0] | |
435 | 435 | let quoteAsset = assets[1] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEPARATOR = "__" | |
5 | 5 | ||
6 | 6 | let KEY_MULTISIG = "MULTISIG" | |
7 | 7 | ||
8 | 8 | let KEY_STATUS = "STATUS" | |
9 | 9 | ||
10 | 10 | let KEY_INIT = "INIT" | |
11 | 11 | ||
12 | 12 | let KEY_SEQUENCER = "SEQUENCER" | |
13 | 13 | ||
14 | 14 | let KEY_ACCOUNT_STORAGE = "ACCOUNT_STORAGE" | |
15 | 15 | ||
16 | 16 | let KEY_FEE_RECIPIENT = "FEE_RECIPIENT" | |
17 | 17 | ||
18 | 18 | let KEY_SYMBOL = "SYMBOL" | |
19 | 19 | ||
20 | 20 | let KEY_ORDER_FILLED_AMOUNT = "ORDER_FILLED_AMOUNT" | |
21 | 21 | ||
22 | 22 | let KEY_REWARD_DISTRIBUTOR = "REWARD_DISTRIBUTOR" | |
23 | 23 | ||
24 | 24 | let FUNC_EXTERNAL_TRANSFER = "externalTransfer" | |
25 | 25 | ||
26 | 26 | let FUNC_CLAIM_REWARD = "claimReward" | |
27 | 27 | ||
28 | 28 | let SPOT_WALLET = "SPOT" | |
29 | 29 | ||
30 | 30 | let ORDER_TYPE_LIMIT = 1 | |
31 | 31 | ||
32 | 32 | let ORDER_TYPE_MARKET = 2 | |
33 | 33 | ||
34 | 34 | let ORDER_VERSION_1 = 1 | |
35 | 35 | ||
36 | 36 | let ORDER_SIDE_BUY = 1 | |
37 | 37 | ||
38 | 38 | let ORDER_SIDE_SELL = 2 | |
39 | 39 | ||
40 | 40 | let ALG_TYPE_WAVES = 1 | |
41 | 41 | ||
42 | 42 | let ALG_TYPE_EVM = 2 | |
43 | 43 | ||
44 | 44 | let ZERO_BIGINT = toBigInt(0) | |
45 | 45 | ||
46 | 46 | let ONE_BIGINT = toBigInt(1) | |
47 | 47 | ||
48 | 48 | let MULTIPLIER = toBigInt(100000000) | |
49 | 49 | ||
50 | 50 | let FEE_MAX_TOLERANCE = toBigInt(100000) | |
51 | 51 | ||
52 | 52 | let WAVES_PREFIX = base58'7YXq4t' | |
53 | 53 | ||
54 | 54 | let EVM_PREFIX = base58'G5Nu92G2p7moXW9qjjN3na7gtq4dWCeVdaSjry' | |
55 | 55 | ||
56 | 56 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
57 | 57 | case a: Address => | |
58 | 58 | true | |
59 | 59 | case _ => | |
60 | 60 | throw(err_) | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func _validateBigInt (val_,lowerBoundary_,err_) = if ((lowerBoundary_ > val_)) | |
65 | 65 | then throw(err_) | |
66 | 66 | else true | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func _validateIntEqual (val1_,val2_,err_) = if ((val1_ != val2_)) | |
70 | 70 | then throw(err_) | |
71 | 71 | else true | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func _validateIntNotEqual (val1_,val2_,err_) = if ((val1_ == val2_)) | |
75 | 75 | then throw(err_) | |
76 | 76 | else true | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func _validateString (val_,err_) = if (if ((0 >= size(val_))) | |
80 | 80 | then true | |
81 | 81 | else contains(val_, SEPARATOR)) | |
82 | 82 | then throw(err_) | |
83 | 83 | else true | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func _validateStringEqual (val1_,val2_,err_) = if ((val1_ != val2_)) | |
87 | 87 | then throw(err_) | |
88 | 88 | else true | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func _loadInit () = match getBoolean(KEY_INIT) { | |
92 | 92 | case a: Boolean => | |
93 | 93 | a | |
94 | 94 | case _ => | |
95 | 95 | false | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
103 | 103 | case a: String => | |
104 | 104 | addressFromStringValue(a) | |
105 | 105 | case _ => | |
106 | 106 | Address(base58'') | |
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func _loadSequencer () = match getString(KEY_SEQUENCER) { | |
114 | 114 | case a: String => | |
115 | 115 | addressFromStringValue(a) | |
116 | 116 | case _ => | |
117 | 117 | Address(base58'') | |
118 | 118 | } | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func _saveSequencer (sequencer_) = [StringEntry(KEY_SEQUENCER, toString(sequencer_))] | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func _loadAccountStorage () = match getString(KEY_ACCOUNT_STORAGE) { | |
125 | 125 | case a: String => | |
126 | 126 | addressFromStringValue(a) | |
127 | 127 | case _ => | |
128 | 128 | Address(base58'') | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func _saveAccountStorage (accountStorage_) = [StringEntry(KEY_ACCOUNT_STORAGE, toString(accountStorage_))] | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func _loadFeeRecipient () = match getString(KEY_FEE_RECIPIENT) { | |
136 | 136 | case a: String => | |
137 | 137 | a | |
138 | 138 | case _ => | |
139 | 139 | "" | |
140 | 140 | } | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func _saveFeeRecipient (feeRecipient_) = [StringEntry(KEY_FEE_RECIPIENT, feeRecipient_)] | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func _loadRewardDistributor () = match getString(KEY_REWARD_DISTRIBUTOR) { | |
147 | 147 | case a: String => | |
148 | 148 | a | |
149 | 149 | case _ => | |
150 | 150 | "" | |
151 | 151 | } | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func _saveRewardDistributor (distributor_) = [StringEntry(KEY_REWARD_DISTRIBUTOR, distributor_)] | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func _loadSymbol (symbol_) = match getBoolean(makeString([KEY_SYMBOL, symbol_], SEPARATOR)) { | |
158 | 158 | case a: Boolean => | |
159 | 159 | a | |
160 | 160 | case _ => | |
161 | 161 | false | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func _saveSymbol (symbol_,val_) = [BooleanEntry(makeString([KEY_SYMBOL, symbol_], SEPARATOR), val_)] | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func _loadOrderFilledAmount (orderHash_) = match getString(makeString([KEY_ORDER_FILLED_AMOUNT, toBase58String(orderHash_)], SEPARATOR)) { | |
169 | 169 | case a: String => | |
170 | 170 | parseBigIntValue(a) | |
171 | 171 | case _ => | |
172 | 172 | ZERO_BIGINT | |
173 | 173 | } | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func _saveOrderFilledAmount (orderHash_,amount_) = [StringEntry(makeString([KEY_ORDER_FILLED_AMOUNT, toBase58String(orderHash_)], SEPARATOR), toString(amount_))] | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
180 | 180 | then throw("_onlyThisContract: revert") | |
181 | 181 | else true | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
185 | 185 | then throw("_whenMultisigSet: revert") | |
186 | 186 | else true | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func _whenNotInitialized () = if (_loadInit()) | |
190 | 190 | then throw("_whenNotInitialized: revert") | |
191 | 191 | else true | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | func _whenInitialized () = if (!(_loadInit())) | |
195 | 195 | then throw("_whenInitialized: revert") | |
196 | 196 | else true | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | func _validateSequencer (caller,err_) = if ((_loadSequencer() != caller)) | |
200 | 200 | then throw(err_) | |
201 | 201 | else true | |
202 | 202 | ||
203 | 203 | ||
204 | 204 | func _validateOrderType (type_,version_,err_) = if (if ((type_ != ORDER_TYPE_LIMIT)) | |
205 | 205 | then (type_ != ORDER_TYPE_MARKET) | |
206 | 206 | else false) | |
207 | 207 | then throw(err_) | |
208 | 208 | else if ((version_ != ORDER_VERSION_1)) | |
209 | 209 | then throw(err_) | |
210 | 210 | else true | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | func _validateOrderSymbol (symbol_,err_) = if (!(_loadSymbol(symbol_))) | |
214 | 214 | then throw(err_) | |
215 | 215 | else true | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | func _validateOrderSide (side_,err_) = if (if ((side_ != ORDER_SIDE_BUY)) | |
219 | 219 | then (side_ != ORDER_SIDE_SELL) | |
220 | 220 | else false) | |
221 | 221 | then throw(err_) | |
222 | 222 | else true | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | func _validateOrderPrices (makerOrderPrice_,takerOrderPrice_,takerOrderSide_,takerOrderType_,err_) = { | |
226 | 226 | let result = if ((takerOrderType_ == ORDER_TYPE_MARKET)) | |
227 | 227 | then true | |
228 | 228 | else if ((takerOrderSide_ == ORDER_SIDE_BUY)) | |
229 | 229 | then (takerOrderPrice_ >= makerOrderPrice_) | |
230 | 230 | else if ((takerOrderSide_ == ORDER_SIDE_SELL)) | |
231 | 231 | then (makerOrderPrice_ >= takerOrderPrice_) | |
232 | 232 | else false | |
233 | 233 | if (!(result)) | |
234 | 234 | then throw(err_) | |
235 | 235 | else true | |
236 | 236 | } | |
237 | 237 | ||
238 | 238 | ||
239 | 239 | func _validateSignatureFormat (signature_,alg_,err_) = if ((alg_ == ALG_TYPE_WAVES)) | |
240 | 240 | then if ((size(signature_) != 64)) | |
241 | 241 | then throw(err_) | |
242 | 242 | else true | |
243 | 243 | else if ((alg_ == ALG_TYPE_EVM)) | |
244 | 244 | then if ((size(signature_) != 65)) | |
245 | 245 | then throw(err_) | |
246 | 246 | else true | |
247 | 247 | else throw((err_ + ": inv alg")) | |
248 | 248 | ||
249 | 249 | ||
250 | 250 | func _validateWeb3Id (web3Id_,alg_,err_) = if ((alg_ == ALG_TYPE_WAVES)) | |
251 | 251 | then if ((size(web3Id_) != 32)) | |
252 | 252 | then throw(err_) | |
253 | 253 | else true | |
254 | 254 | else if ((alg_ == ALG_TYPE_EVM)) | |
255 | 255 | then if ((size(web3Id_) != 20)) | |
256 | 256 | then throw(err_) | |
257 | 257 | else true | |
258 | 258 | else throw((err_ + ": inv alg")) | |
259 | 259 | ||
260 | 260 | ||
261 | 261 | func _convertWeb3IdToAddress (web3Id_,alg_) = if ((alg_ == ALG_TYPE_WAVES)) | |
262 | 262 | then toString(addressFromPublicKey(web3Id_)) | |
263 | 263 | else if ((alg_ == ALG_TYPE_EVM)) | |
264 | 264 | then ("0x" + toBase16String(web3Id_)) | |
265 | 265 | else throw("_convertWeb3IdToAddress: revert") | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | func _validateOrderSignature (orderHash_,signature_,web3Id_,alg_,err_) = { | |
269 | 269 | let result = if ((alg_ == ALG_TYPE_WAVES)) | |
270 | 270 | then { | |
271 | - | let | |
272 | - | sigVerify( | |
271 | + | let msg = (WAVES_PREFIX + toBytes(toBase58String(orderHash_))) | |
272 | + | sigVerify(msg, signature_, web3Id_) | |
273 | 273 | } | |
274 | 274 | else if ((alg_ == ALG_TYPE_EVM)) | |
275 | 275 | then { | |
276 | 276 | let hashWithPrefix = keccak256_16Kb((EVM_PREFIX + orderHash_)) | |
277 | 277 | (takeRight(keccak256_16Kb(ecrecover(hashWithPrefix, signature_)), 20) == web3Id_) | |
278 | 278 | } | |
279 | 279 | else throw((err_ + ": inv alg")) | |
280 | 280 | if (!(result)) | |
281 | 281 | then throw(err_) | |
282 | 282 | else true | |
283 | 283 | } | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | func _validateFeeTolerance (amount_,fee_,err_) = if ((fee_ > fraction(amount_, FEE_MAX_TOLERANCE, MULTIPLIER, DOWN))) | |
287 | 287 | then throw(err_) | |
288 | 288 | else true | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | func _parseOrder (order_,err_) = { | |
292 | 292 | let fields = split(order_, SEPARATOR) | |
293 | 293 | let type = valueOrErrorMessage(parseInt(fields[0]), (err_ + ": inv type")) | |
294 | 294 | let version = valueOrErrorMessage(parseInt(fields[1]), (err_ + ": inv version")) | |
295 | 295 | let symbol = fields[2] | |
296 | 296 | let side = valueOrErrorMessage(parseInt(fields[3]), (err_ + ": inv side")) | |
297 | 297 | let ts = valueOrErrorMessage(parseInt(fields[4]), (err_ + ": inv ts")) | |
298 | 298 | let web3Id = fromBase58String(fields[5]) | |
299 | 299 | let alg = valueOrErrorMessage(parseInt(fields[6]), (err_ + ": inv alg")) | |
300 | 300 | let signature = fromBase58String(fields[7]) | |
301 | - | let $ | |
301 | + | let $t084629500 = if (if ((type == ORDER_TYPE_LIMIT)) | |
302 | 302 | then (version == ORDER_VERSION_1) | |
303 | 303 | else false) | |
304 | 304 | then { | |
305 | 305 | let price = valueOrErrorMessage(parseBigInt(fields[8]), (err_ + ": inv price")) | |
306 | 306 | let amount = valueOrErrorMessage(parseBigInt(fields[9]), (err_ + ": inv amount")) | |
307 | 307 | let orderDetailsBytes = (toBytes(price) + toBytes(amount)) | |
308 | 308 | $Tuple4(price, amount, ZERO_BIGINT, orderDetailsBytes) | |
309 | 309 | } | |
310 | 310 | else if (if ((type == ORDER_TYPE_MARKET)) | |
311 | 311 | then (version == ORDER_VERSION_1) | |
312 | 312 | else false) | |
313 | 313 | then { | |
314 | 314 | let amount = valueOrErrorMessage(parseBigInt(fields[8]), (err_ + ": inv amount")) | |
315 | 315 | let isBaseAmount = if ((valueOrErrorMessage(parseBigInt(fields[9]), (err_ + ": inv isBaseAmount")) == ZERO_BIGINT)) | |
316 | 316 | then false | |
317 | 317 | else true | |
318 | 318 | if (isBaseAmount) | |
319 | 319 | then $Tuple4(ZERO_BIGINT, amount, ZERO_BIGINT, (toBytes(amount) + toBytes(ONE_BIGINT))) | |
320 | 320 | else $Tuple4(ZERO_BIGINT, ZERO_BIGINT, amount, (toBytes(amount) + toBytes(ZERO_BIGINT))) | |
321 | 321 | } | |
322 | 322 | else throw((err_ + ": inv type & version")) | |
323 | - | let price = $ | |
324 | - | let baseAmount = $ | |
325 | - | let quoteAmount = $ | |
326 | - | let orderDetailsBytes = $ | |
323 | + | let price = $t084629500._1 | |
324 | + | let baseAmount = $t084629500._2 | |
325 | + | let quoteAmount = $t084629500._3 | |
326 | + | let orderDetailsBytes = $t084629500._4 | |
327 | 327 | let orderBytes = ((((((((toBytes(type) + toBytes(version)) + toBytes(size(symbol))) + toBytes(symbol)) + toBytes(side)) + toBytes(ts)) + web3Id) + toBytes(alg)) + orderDetailsBytes) | |
328 | 328 | let orderHash = keccak256_32Kb(orderBytes) | |
329 | 329 | let err = if (if (if (if (if (if (if (_validateOrderType(type, version, (err_ + ": inv order type"))) | |
330 | 330 | then _validateOrderSymbol(symbol, (err_ + ": inv order symbol")) | |
331 | 331 | else false) | |
332 | 332 | then _validateOrderSide(side, (err_ + ": inv order side")) | |
333 | 333 | else false) | |
334 | 334 | then _validateWeb3Id(web3Id, alg, (err_ + ": inv order web3Id")) | |
335 | 335 | else false) | |
336 | 336 | then _validateSignatureFormat(signature, alg, (err_ + ": inv sig format")) | |
337 | 337 | else false) | |
338 | 338 | then _validateBigInt(price, ZERO_BIGINT, (err_ + ": neg price")) | |
339 | 339 | else false) | |
340 | 340 | then _validateBigInt(baseAmount, ZERO_BIGINT, (err_ + ": neg base amount")) | |
341 | 341 | else false) | |
342 | 342 | then _validateBigInt(quoteAmount, ZERO_BIGINT, (err_ + ": neg quote amount")) | |
343 | 343 | else false | |
344 | 344 | if ((err == err)) | |
345 | 345 | then $Tuple10(type, symbol, side, price, baseAmount, quoteAmount, orderHash, web3Id, alg, signature) | |
346 | 346 | else throw("Strict value is not equal to itself.") | |
347 | 347 | } | |
348 | 348 | ||
349 | 349 | ||
350 | 350 | @Callable(i) | |
351 | 351 | func init (sequencer_,accountStorage_,feeRecipient_) = { | |
352 | 352 | let err = if (if (if (if (if (_onlyThisContract(i.caller)) | |
353 | 353 | then _whenNotInitialized() | |
354 | 354 | else false) | |
355 | 355 | then _whenMultisigSet() | |
356 | 356 | else false) | |
357 | 357 | then _validateAddress(sequencer_, "init: invalid sequencer") | |
358 | 358 | else false) | |
359 | 359 | then _validateAddress(accountStorage_, "init: invalid accountStorage") | |
360 | 360 | else false) | |
361 | 361 | then _validateString(feeRecipient_, "init: invalid feeRecipient") | |
362 | 362 | else false | |
363 | 363 | if ((err == err)) | |
364 | 364 | then $Tuple2((((_saveInit(true) ++ _saveSequencer(addressFromStringValue(sequencer_))) ++ _saveAccountStorage(addressFromStringValue(accountStorage_))) ++ _saveFeeRecipient(feeRecipient_)), unit) | |
365 | 365 | else throw("Strict value is not equal to itself.") | |
366 | 366 | } | |
367 | 367 | ||
368 | 368 | ||
369 | 369 | ||
370 | 370 | @Callable(i) | |
371 | 371 | func trade (makerOrder_,takerOrder_,baseFee_,quoteFee_) = { | |
372 | - | let $ | |
373 | - | let makerOrderType = $ | |
374 | - | let makerOrderSymbol = $ | |
375 | - | let makerOrderSide = $ | |
376 | - | let makerOrderPrice = $ | |
377 | - | let makerOrderBaseAmount = $ | |
378 | - | let makerOrderQuoteAmount = $ | |
379 | - | let makerOrderHash = $ | |
380 | - | let makerOrderWeb3Id = $ | |
381 | - | let makerOrderAlg = $ | |
382 | - | let makerOrderSignature = $ | |
383 | - | let $ | |
384 | - | let takerOrderType = $ | |
385 | - | let takerOrderSymbol = $ | |
386 | - | let takerOrderSide = $ | |
387 | - | let takerOrderPrice = $ | |
388 | - | let takerOrderBaseAmount = $ | |
389 | - | let takerOrderQuoteAmount = $ | |
390 | - | let takerOrderHash = $ | |
391 | - | let takerOrderWeb3Id = $ | |
392 | - | let takerOrderAlg = $ | |
393 | - | let takerOrderSignature = $ | |
372 | + | let $t01131611645 = _parseOrder(makerOrder_, "trade: invalid maker order") | |
373 | + | let makerOrderType = $t01131611645._1 | |
374 | + | let makerOrderSymbol = $t01131611645._2 | |
375 | + | let makerOrderSide = $t01131611645._3 | |
376 | + | let makerOrderPrice = $t01131611645._4 | |
377 | + | let makerOrderBaseAmount = $t01131611645._5 | |
378 | + | let makerOrderQuoteAmount = $t01131611645._6 | |
379 | + | let makerOrderHash = $t01131611645._7 | |
380 | + | let makerOrderWeb3Id = $t01131611645._8 | |
381 | + | let makerOrderAlg = $t01131611645._9 | |
382 | + | let makerOrderSignature = $t01131611645._10 | |
383 | + | let $t01165111980 = _parseOrder(takerOrder_, "trade: invalid taker order") | |
384 | + | let takerOrderType = $t01165111980._1 | |
385 | + | let takerOrderSymbol = $t01165111980._2 | |
386 | + | let takerOrderSide = $t01165111980._3 | |
387 | + | let takerOrderPrice = $t01165111980._4 | |
388 | + | let takerOrderBaseAmount = $t01165111980._5 | |
389 | + | let takerOrderQuoteAmount = $t01165111980._6 | |
390 | + | let takerOrderHash = $t01165111980._7 | |
391 | + | let takerOrderWeb3Id = $t01165111980._8 | |
392 | + | let takerOrderAlg = $t01165111980._9 | |
393 | + | let takerOrderSignature = $t01165111980._10 | |
394 | 394 | let baseFee = valueOrErrorMessage(parseBigInt(baseFee_), "trade: baseFee not int") | |
395 | 395 | let quoteFee = valueOrErrorMessage(parseBigInt(quoteFee_), "trade: quoteFee not int") | |
396 | 396 | let tradePrice = makerOrderPrice | |
397 | 397 | let makerOrderFilledAmount = _loadOrderFilledAmount(makerOrderHash) | |
398 | 398 | let makerOrderBaseAmountFree = (makerOrderBaseAmount - makerOrderFilledAmount) | |
399 | 399 | let takerOrderFilledAmount = _loadOrderFilledAmount(takerOrderHash) | |
400 | 400 | let takerOrderBaseAmountFree = if ((takerOrderBaseAmount == ZERO_BIGINT)) | |
401 | 401 | then fraction((takerOrderQuoteAmount - takerOrderFilledAmount), MULTIPLIER, tradePrice, DOWN) | |
402 | 402 | else (takerOrderBaseAmount - takerOrderFilledAmount) | |
403 | 403 | let tradeBaseAmount = min([makerOrderBaseAmountFree, takerOrderBaseAmountFree]) | |
404 | 404 | let tradeQuoteAmount = fraction(tradeBaseAmount, tradePrice, MULTIPLIER, DOWN) | |
405 | 405 | let err = if (if (if (if (if (if (if (if (if (_validateSequencer(i.caller, "trade: invalid sequencer")) | |
406 | 406 | then _validateBigInt(tradeBaseAmount, ZERO_BIGINT, "trade: neg trade amount") | |
407 | 407 | else false) | |
408 | 408 | then _validateIntEqual(makerOrderType, ORDER_TYPE_LIMIT, "trade: maker is not limit") | |
409 | 409 | else false) | |
410 | 410 | then _validateStringEqual(makerOrderSymbol, takerOrderSymbol, "trade: symbol mismatch") | |
411 | 411 | else false) | |
412 | 412 | then _validateIntNotEqual(makerOrderSide, takerOrderSide, "trade: side mismatch") | |
413 | 413 | else false) | |
414 | 414 | then _validateOrderSignature(makerOrderHash, makerOrderSignature, makerOrderWeb3Id, makerOrderAlg, "trade: invalid maker sig") | |
415 | 415 | else false) | |
416 | 416 | then _validateOrderSignature(takerOrderHash, takerOrderSignature, takerOrderWeb3Id, takerOrderAlg, "trade: invalid taker sig") | |
417 | 417 | else false) | |
418 | 418 | then _validateFeeTolerance(tradeBaseAmount, baseFee, "trade: base fee too much") | |
419 | 419 | else false) | |
420 | 420 | then _validateFeeTolerance(tradeQuoteAmount, quoteFee, "trade: quote fee too much") | |
421 | 421 | else false) | |
422 | 422 | then _validateOrderPrices(makerOrderPrice, takerOrderPrice, takerOrderSide, takerOrderType, "trade: prices mismatch") | |
423 | 423 | else false | |
424 | 424 | if ((err == err)) | |
425 | 425 | then { | |
426 | 426 | let makerAddress = _convertWeb3IdToAddress(makerOrderWeb3Id, makerOrderAlg) | |
427 | 427 | let takerAddress = _convertWeb3IdToAddress(takerOrderWeb3Id, takerOrderAlg) | |
428 | - | let $ | |
428 | + | let $t01413714560 = if ((makerOrderSide == ORDER_SIDE_BUY)) | |
429 | 429 | then $Tuple2(makerAddress, takerAddress) | |
430 | 430 | else $Tuple2(takerAddress, makerAddress) | |
431 | - | let buyer = $ | |
432 | - | let seller = $ | |
431 | + | let buyer = $t01413714560._1 | |
432 | + | let seller = $t01413714560._2 | |
433 | 433 | let assets = split(makerOrderSymbol, "-") | |
434 | 434 | let baseAsset = assets[0] | |
435 | 435 | let quoteAsset = assets[1] | |
436 | 436 | let feeRecipient = _loadFeeRecipient() | |
437 | 437 | let storageInvocation = invoke(_loadAccountStorage(), FUNC_EXTERNAL_TRANSFER, [SPOT_WALLET, baseAsset, seller, buyer, toString(tradeBaseAmount), toString(baseFee), feeRecipient], nil) | |
438 | 438 | if ((storageInvocation == storageInvocation)) | |
439 | 439 | then { | |
440 | 440 | let storageInvocation1 = invoke(_loadAccountStorage(), FUNC_EXTERNAL_TRANSFER, [SPOT_WALLET, quoteAsset, buyer, seller, toString(tradeQuoteAmount), toString(quoteFee), feeRecipient], nil) | |
441 | 441 | if ((storageInvocation1 == storageInvocation1)) | |
442 | 442 | then { | |
443 | 443 | let newMakerOrderFilledAmount = (makerOrderFilledAmount + tradeBaseAmount) | |
444 | 444 | let newTakerOrderFilledAmount = if ((takerOrderBaseAmount == ZERO_BIGINT)) | |
445 | 445 | then (takerOrderFilledAmount + tradeQuoteAmount) | |
446 | 446 | else (takerOrderFilledAmount + tradeBaseAmount) | |
447 | 447 | $Tuple2((_saveOrderFilledAmount(makerOrderHash, newMakerOrderFilledAmount) ++ _saveOrderFilledAmount(takerOrderHash, newTakerOrderFilledAmount)), unit) | |
448 | 448 | } | |
449 | 449 | else throw("Strict value is not equal to itself.") | |
450 | 450 | } | |
451 | 451 | else throw("Strict value is not equal to itself.") | |
452 | 452 | } | |
453 | 453 | else throw("Strict value is not equal to itself.") | |
454 | 454 | } | |
455 | 455 | ||
456 | 456 | ||
457 | 457 | ||
458 | 458 | @Callable(i) | |
459 | 459 | func claimReward (user_,currency_,amount_) = { | |
460 | 460 | let amount = valueOrErrorMessage(parseBigInt(amount_), "claimReward: amount not int") | |
461 | 461 | let err = if (if (if (_validateSequencer(i.caller, "claimReward: invalid sequencer")) | |
462 | 462 | then _validateString(user_, "claimReward: invalid user") | |
463 | 463 | else false) | |
464 | 464 | then _validateString(currency_, "claimReward: invalid currency") | |
465 | 465 | else false) | |
466 | 466 | then _validateBigInt(amount, ZERO_BIGINT, "claimReward: neg amount") | |
467 | 467 | else false | |
468 | 468 | if ((err == err)) | |
469 | 469 | then { | |
470 | 470 | let storageInvocation = invoke(_loadAccountStorage(), FUNC_CLAIM_REWARD, [_loadRewardDistributor(), user_, currency_, amount_], nil) | |
471 | 471 | if ((storageInvocation == storageInvocation)) | |
472 | 472 | then $Tuple2(nil, unit) | |
473 | 473 | else throw("Strict value is not equal to itself.") | |
474 | 474 | } | |
475 | 475 | else throw("Strict value is not equal to itself.") | |
476 | 476 | } | |
477 | 477 | ||
478 | 478 | ||
479 | 479 | ||
480 | 480 | @Callable(i) | |
481 | 481 | func updateSymbol (symbol_,allowance_) = { | |
482 | 482 | let err = if (_onlyThisContract(i.caller)) | |
483 | 483 | then _validateString(symbol_, "updateSymbol: invalid symbol") | |
484 | 484 | else false | |
485 | 485 | if ((err == err)) | |
486 | 486 | then $Tuple2(_saveSymbol(symbol_, allowance_), unit) | |
487 | 487 | else throw("Strict value is not equal to itself.") | |
488 | 488 | } | |
489 | 489 | ||
490 | 490 | ||
491 | 491 | ||
492 | 492 | @Callable(i) | |
493 | 493 | func updateFeeRecipient (feeRecipient_) = { | |
494 | 494 | let err = if (if (_onlyThisContract(i.caller)) | |
495 | 495 | then _whenInitialized() | |
496 | 496 | else false) | |
497 | 497 | then _validateString(feeRecipient_, "updateFeeRecipient: invalid feeRecipient") | |
498 | 498 | else false | |
499 | 499 | if ((err == err)) | |
500 | 500 | then $Tuple2(_saveFeeRecipient(feeRecipient_), unit) | |
501 | 501 | else throw("Strict value is not equal to itself.") | |
502 | 502 | } | |
503 | 503 | ||
504 | 504 | ||
505 | 505 | ||
506 | 506 | @Callable(i) | |
507 | 507 | func updateRewardDistributor (rewardDistributor_) = { | |
508 | 508 | let err = if (if (_onlyThisContract(i.caller)) | |
509 | 509 | then _whenInitialized() | |
510 | 510 | else false) | |
511 | 511 | then _validateString(rewardDistributor_, "updateRewardDistributor: invalid rewardDistributor") | |
512 | 512 | else false | |
513 | 513 | if ((err == err)) | |
514 | 514 | then $Tuple2(_saveRewardDistributor(rewardDistributor_), unit) | |
515 | 515 | else throw("Strict value is not equal to itself.") | |
516 | 516 | } | |
517 | 517 | ||
518 | 518 | ||
519 | 519 | ||
520 | 520 | @Callable(i) | |
521 | 521 | func setMultisig (multisig_) = { | |
522 | 522 | let err = if (_onlyThisContract(i.caller)) | |
523 | 523 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
524 | 524 | else false | |
525 | 525 | if ((err == err)) | |
526 | 526 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
527 | 527 | else throw("Strict value is not equal to itself.") | |
528 | 528 | } | |
529 | 529 | ||
530 | 530 | ||
531 | 531 | @Verifier(tx) | |
532 | 532 | func verify () = match getString(KEY_MULTISIG) { | |
533 | 533 | case multisig: String => | |
534 | 534 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
535 | 535 | case _ => | |
536 | 536 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
537 | 537 | } | |
538 | 538 |
github/deemru/w8io/169f3d6 66.86 ms ◑