tx · 7xFZNz985VKPzaYDyMqb8ESKpoCmugPRbvKHGek6khZg 3N3kKNoJohjVQYNLTrYTGTesr3nq3PZNh37: -0.02100000 Waves 2024.05.15 13:06 [3106994] smart account 3N3kKNoJohjVQYNLTrYTGTesr3nq3PZNh37 > SELF 0.00000000 Waves
{ "type": 13, "id": "7xFZNz985VKPzaYDyMqb8ESKpoCmugPRbvKHGek6khZg", "fee": 2100000, "feeAssetId": null, "timestamp": 1715767583851, "version": 2, "chainId": 84, "sender": "3N3kKNoJohjVQYNLTrYTGTesr3nq3PZNh37", "senderPublicKey": "vmMXxwQAMUAoisvL193ptPiTtaWQqL5YNu2zs1ouTbY", "proofs": [ "3rEXec2NpD63N4NxzdrUjZpvmPSHCs5kAFkV4gGn8XdXdzCuPLyRVQ8VVB4o35PJ81pd1yokuwjwjhSvCCNARUsy" ], "script": "base64:BwI9CAISAwoBCBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGFMACXNlcGFyYXRvcgICX18AB2NoYWluSWQJAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEACGNoYWluSWRXAQFXABBjb250cmFjdEZpbGVuYW1lAhdmdXR1cmVzX2NhbGN1bGF0b3IucmlkZQAFbXVsdDgAgMLXLwAMbXVsdDE4QmlnSW50CQC2AgEAgICQu7rWrfANAA13YXZlc0RlY2ltYWxzAAgADHVzZHREZWNpbWFscwAGAAt3YXZlc1N0cmluZwIFV0FWRVMADXF1ZXVlSXRlbVNpemUAIAAEYmlnMAkAtgIBAAAACWtNdWx0aXNpZwIMJXNfX211bHRpc2lnAQdrU3RhdHVzAgRkYXBwBHR4SWQJALkJAgkAzAgCAgolc19fc3RhdHVzCQDMCAIFBGRhcHAJAMwIAgUEdHhJZAUDbmlsBQlzZXBhcmF0b3IACWtTaHV0ZG93bgIMJXNfX3NodXRkb3duAAtrUHVibGljS2V5cwIOJXNfX3B1YmxpY0tleXMAEWtNYXRjaGVyUHVibGljS2V5AhQ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lzaWcFCXN0YXR1c0tleQcFBnN0YXR1cwcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkQm8b/", "height": 3106994, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 59XkgwYmq5mHKfEiwAkDae3jNdFQgF8gfUfxuAgAXJf8 Next: CD5g85vYA2m5vvcK62RtTKu1afc3XFYE1UFzpK4KHEit Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let queueItemSize = 32 | |
23 | + | ||
24 | + | let big0 = toBigInt(0) | |
23 | 25 | ||
24 | 26 | let kMultisig = "%s__multisig" | |
25 | 27 | ||
55 | 57 | func assetIdToString (input) = if ((input == unit)) | |
56 | 58 | then wavesString | |
57 | 59 | else toBase58String(value(input)) | |
60 | + | ||
61 | + | ||
62 | + | func getAssetInfoOrFail (assetId) = valueOrErrorMessage(assetInfo(assetId), wrapErr("invalid asset info")) | |
63 | + | ||
64 | + | ||
65 | + | func getAssetDecimalsOrFail (assetId) = match assetId { | |
66 | + | case _: Unit => | |
67 | + | wavesDecimals | |
68 | + | case assetId: ByteVector => | |
69 | + | getAssetInfoOrFail(assetId).decimals | |
70 | + | case _ => | |
71 | + | throw("Match error") | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | func pow10 (n) = pow(10, 0, n, 0, 0, DOWN) | |
76 | + | ||
77 | + | ||
78 | + | func pow10Decimals (assetId) = pow10(getAssetDecimalsOrFail(assetId)) | |
58 | 79 | ||
59 | 80 | ||
60 | 81 | let kFactoryAddress = "%s__factoryAddress" | |
202 | 223 | } | |
203 | 224 | ||
204 | 225 | ||
205 | - | func calcTotalCredit (creditA,creditB,currentPrice) = ((creditA | |
226 | + | func calcTotalCredit (creditA,creditB,currentPrice) = (fraction(creditA, currentPrice, mult18BigInt) + creditB) | |
206 | 227 | ||
207 | 228 | ||
208 | - | func calcTotalBalance (balanceA,balanceB,currentPrice) = ((balanceA | |
229 | + | func calcTotalBalance (balanceA,balanceB,currentPrice) = (fraction(balanceA, currentPrice, mult18BigInt) + balanceB) | |
209 | 230 | ||
210 | 231 | ||
211 | 232 | func calcPnl (totalBalance,totalCredit) = (totalBalance - totalCredit) | |
212 | 233 | ||
213 | 234 | ||
214 | - | func calcCreditAvailable (deposit,leverage,totalCredit) = ((deposit | |
235 | + | func calcCreditAvailable (deposit,leverage,totalCredit) = (fraction(deposit, leverage, mult18BigInt) - totalCredit) | |
215 | 236 | ||
216 | 237 | ||
217 | - | func calcRealInCredit (credit,balance) = if ((credit > | |
238 | + | func calcRealInCredit (credit,balance) = if ((credit > big0)) | |
218 | 239 | then (credit - balance) | |
219 | - | else | |
240 | + | else big0 | |
220 | 241 | ||
221 | 242 | ||
222 | - | func calcFree (credit,balance) = if ((credit > | |
243 | + | func calcFree (credit,balance) = if ((credit > big0)) | |
223 | 244 | then (balance - credit) | |
224 | - | else | |
245 | + | else big0 | |
225 | 246 | ||
226 | 247 | ||
227 | - | func calcShortPrice (free,realInCredit) = if ((realInCredit > | |
228 | - | then max([ | |
229 | - | else | |
248 | + | func calcShortPrice (free,realInCredit) = if ((realInCredit > big0)) | |
249 | + | then max([big0, fraction(free, mult18BigInt, realInCredit)]) | |
250 | + | else big0 | |
230 | 251 | ||
231 | 252 | ||
232 | - | func calcLongPrice (free,realInCredit) = if ((realInCredit > | |
233 | - | then max([ | |
234 | - | else | |
253 | + | func calcLongPrice (free,realInCredit) = if ((realInCredit > big0)) | |
254 | + | then max([big0, fraction(realInCredit, mult18BigInt, free)]) | |
255 | + | else big0 | |
235 | 256 | ||
236 | 257 | ||
237 | - | func calcStartMargin (realInCreditA,realInCreditB,currentPrice,settingsMargin) = (((realInCreditA | |
258 | + | func calcStartMargin (realInCreditA,realInCreditB,currentPrice,settingsMargin) = fraction((fraction(realInCreditA, currentPrice, mult18BigInt) + realInCreditB), settingsMargin, mult18BigInt) | |
238 | 259 | ||
239 | 260 | ||
240 | - | func calcMarginSupply (settingsMarginSupply,settingsMargin,startMargin) = | |
261 | + | func calcMarginSupply (settingsMarginSupply,settingsMargin,startMargin) = fraction(settingsMarginSupply, startMargin, settingsMargin) | |
241 | 262 | ||
242 | 263 | ||
243 | 264 | func calcLiquidationPrice (deposit,marginSupply,realInCreditA,realInCreditB,shortPrice,longPrice) = { | |
298 | 319 | else throwErr(("accounts limit is " + toString(accountsLimit())))] | |
299 | 320 | if ((checks == checks)) | |
300 | 321 | then { | |
301 | - | let $ | |
322 | + | let $t01074712103 = if ((size(accountsQueue()) == 0)) | |
302 | 323 | then $Tuple2([ScriptTransfer(factoryAddress, rewardAmount(), unit)], [invoke(factoryAddress, "integerEntry", [kRequestStatus(requestId), REQUEST_STATUS_EMPTY], nil), invoke(factoryAddress, "binaryEntry", [kRequestsQueue(), (requestsQueue() + requestId)], nil)]) | |
303 | 324 | else { | |
304 | 325 | let accountPublicKey = take(accountsQueue(), queueItemSize) | |
306 | 327 | let creatorAddress = addressFromPublicKey(valueOrErrorMessage(getBinary(factoryAddress, kAccountCreatorPublicKey(accountAddress)), wrapErr("invalid creator public key"))) | |
307 | 328 | $Tuple2([ScriptTransfer(creatorAddress, rewardAmount(), unit)], [invoke(factoryAddress, "binaryEntry", [kAccountsQueue(), drop(accountsQueue(), queueItemSize)], nil), invoke(factoryAddress, "integerEntry", [kRequestStatus(requestId), REQUEST_STATUS_READY], nil), invoke(factoryAddress, "binaryEntry", [kRequestIdToAccountPublicKey(requestId), accountPublicKey], nil), invoke(factoryAddress, "stringEntry", [kAccountAddressToRequestId(accountAddress), toBase58String(requestId)], nil)]) | |
308 | 329 | } | |
309 | - | let actions = $ | |
310 | - | let factoryActions = $ | |
330 | + | let actions = $t01074712103._1 | |
331 | + | let factoryActions = $t01074712103._2 | |
311 | 332 | $Tuple2(actions, (factoryActions ++ [invoke(factoryAddress, "binaryEntry", [kRequestOwnerPublicKey(requestId), callerPublicKey], nil), invoke(factoryAddress, "binaryEntry", [kRequestsByOwner(userAddress), (requestsByOwner(userAddress) + requestId)], nil), invoke(factoryAddress, "stringEntry", [kRequestAmountAssetId(requestId), amountAssetIdStr], nil), invoke(factoryAddress, "stringEntry", [kRequestPriceAssetId(requestId), priceAssetIdStr], nil)])) | |
312 | 333 | } | |
313 | 334 | else throw("Strict value is not equal to itself.") | |
340 | 361 | else throwErr("invalid script")] | |
341 | 362 | if ((checks == checks)) | |
342 | 363 | then { | |
343 | - | let $ | |
364 | + | let $t01335814360 = if ((size(requestsQueue()) == 0)) | |
344 | 365 | then $Tuple2(nil, [invoke(factoryAddress, "binaryEntry", [kAccountsQueue(), (accountsQueue() + accountPublicKey)], nil)]) | |
345 | 366 | else { | |
346 | 367 | let requestId = take(requestsQueue(), queueItemSize) | |
347 | 368 | $Tuple2(nil, [invoke(factoryAddress, "integerEntry", [kRequestStatus(requestId), REQUEST_STATUS_READY], nil), invoke(factoryAddress, "binaryEntry", [kRequestIdToAccountPublicKey(requestId), accountPublicKey], nil), invoke(factoryAddress, "binaryEntry", [kRequestsQueue(), drop(requestsQueue(), queueItemSize)], nil), invoke(factoryAddress, "stringEntry", [kAccountAddressToRequestId(accountAddress), toBase58String(requestId)], nil), invoke(factoryAddress, "transferWaves", [creatorAddress.bytes, rewardAmount()], nil)]) | |
348 | 369 | } | |
349 | - | let actions = $ | |
350 | - | let factoryActions = $ | |
370 | + | let actions = $t01335814360._1 | |
371 | + | let factoryActions = $t01335814360._2 | |
351 | 372 | $Tuple2(actions, (factoryActions ++ [invoke(factoryAddress, "binaryEntry", [kAccountCreatorPublicKey(accountAddress), creatorPublicKey], nil)])) | |
352 | 373 | } | |
353 | 374 | else throw("Strict value is not equal to itself.") | |
408 | 429 | let accountAddress = valueOrErrorMessage(addressFromString(args[0]), wrapErr("invalid account address")) | |
409 | 430 | let assetId = parseAssetId(args[1]) | |
410 | 431 | let amountRaw = parseInt(args[2]) | |
411 | - | let | |
412 | - | let | |
413 | - | let | |
414 | - | let | |
415 | - | let currentPrice = getCurrentPrice(amountAssetId) | |
416 | - | let creditA = valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, amountAssetId)), 0) | |
417 | - | let creditB = valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, priceAssetId)), 0) | |
432 | + | let $t01643516512 = getAssetsByAccountAddress(accountAddress) | |
433 | + | let amountAssetId = $t01643516512._1 | |
434 | + | let priceAssetId = $t01643516512._2 | |
435 | + | let deposited = toX18(valueOrElse(depositedOption(accountAddress), 0), pow10Decimals(priceAssetId)) | |
436 | + | let currentPrice = toX18(getCurrentPrice(amountAssetId), pow10Decimals(usdtAssetId)) | |
437 | + | let creditA = toX18(valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, amountAssetId)), 0), pow10Decimals(amountAssetId)) | |
438 | + | let creditB = toX18(valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, priceAssetId)), 0), pow10Decimals(priceAssetId)) | |
418 | 439 | let totalCredit = calcTotalCredit(creditA, creditB, currentPrice) | |
419 | 440 | let leverageDefault = 3 | |
420 | - | let leverage = valueOrElse(getInteger(factoryAddress, kLeverage(accountAddress)), leverageDefault) | |
441 | + | let leverage = toX18(valueOrElse(getInteger(factoryAddress, kLeverage(accountAddress)), leverageDefault), 1) | |
421 | 442 | let creditAvailable = calcCreditAvailable(deposited, leverage, totalCredit) | |
422 | - | $Tuple2(nil, [creditAvailable]) | |
443 | + | $Tuple2(nil, [fromX18(creditAvailable, pow10Decimals(priceAssetId))]) | |
423 | 444 | } | |
424 | 445 | else throw("Strict value is not equal to itself.") | |
425 | 446 | } |
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 chainId = take(drop(this.bytes, 1), 1) | |
7 | 7 | ||
8 | 8 | let chainIdW = base58'2W' | |
9 | 9 | ||
10 | 10 | let contractFilename = "futures_calculator.ride" | |
11 | 11 | ||
12 | 12 | let mult8 = 100000000 | |
13 | 13 | ||
14 | 14 | let mult18BigInt = toBigInt(1000000000000000000) | |
15 | 15 | ||
16 | 16 | let wavesDecimals = 8 | |
17 | 17 | ||
18 | 18 | let usdtDecimals = 6 | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let queueItemSize = 32 | |
23 | + | ||
24 | + | let big0 = toBigInt(0) | |
23 | 25 | ||
24 | 26 | let kMultisig = "%s__multisig" | |
25 | 27 | ||
26 | 28 | func kStatus (dapp,txId) = makeString(["%s__status", dapp, txId], separator) | |
27 | 29 | ||
28 | 30 | ||
29 | 31 | let kShutdown = "%s__shutdown" | |
30 | 32 | ||
31 | 33 | let kPublicKeys = "%s__publicKeys" | |
32 | 34 | ||
33 | 35 | let kMatcherPublicKey = "%s__matcherPublicKey" | |
34 | 36 | ||
35 | 37 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), mult18BigInt, toBigInt(origScaleMult)) | |
36 | 38 | ||
37 | 39 | ||
38 | 40 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), mult18BigInt)) | |
39 | 41 | ||
40 | 42 | ||
41 | 43 | func validateAddress (address) = isDefined(addressFromString(address)) | |
42 | 44 | ||
43 | 45 | ||
44 | 46 | func wrapErr (s) = ((contractFilename + ": ") + s) | |
45 | 47 | ||
46 | 48 | ||
47 | 49 | func throwErr (s) = throw(wrapErr(s)) | |
48 | 50 | ||
49 | 51 | ||
50 | 52 | func parseAssetId (input) = if ((input == wavesString)) | |
51 | 53 | then unit | |
52 | 54 | else fromBase58String(input) | |
53 | 55 | ||
54 | 56 | ||
55 | 57 | func assetIdToString (input) = if ((input == unit)) | |
56 | 58 | then wavesString | |
57 | 59 | else toBase58String(value(input)) | |
60 | + | ||
61 | + | ||
62 | + | func getAssetInfoOrFail (assetId) = valueOrErrorMessage(assetInfo(assetId), wrapErr("invalid asset info")) | |
63 | + | ||
64 | + | ||
65 | + | func getAssetDecimalsOrFail (assetId) = match assetId { | |
66 | + | case _: Unit => | |
67 | + | wavesDecimals | |
68 | + | case assetId: ByteVector => | |
69 | + | getAssetInfoOrFail(assetId).decimals | |
70 | + | case _ => | |
71 | + | throw("Match error") | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | func pow10 (n) = pow(10, 0, n, 0, 0, DOWN) | |
76 | + | ||
77 | + | ||
78 | + | func pow10Decimals (assetId) = pow10(getAssetDecimalsOrFail(assetId)) | |
58 | 79 | ||
59 | 80 | ||
60 | 81 | let kFactoryAddress = "%s__factoryAddress" | |
61 | 82 | ||
62 | 83 | let factoryAddressOption = match getString(this, kFactoryAddress) { | |
63 | 84 | case s: String => | |
64 | 85 | addressFromString(s) | |
65 | 86 | case _: Unit => | |
66 | 87 | unit | |
67 | 88 | case _ => | |
68 | 89 | throw("Match error") | |
69 | 90 | } | |
70 | 91 | ||
71 | 92 | let factoryAddress = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
72 | 93 | ||
73 | 94 | let kUsdtAssetId = "%s__usdtAssetId" | |
74 | 95 | ||
75 | 96 | let usdtAssetIdOption = match getString(this, kUsdtAssetId) { | |
76 | 97 | case s: String => | |
77 | 98 | parseAssetId(s) | |
78 | 99 | case _: Unit => | |
79 | 100 | unit | |
80 | 101 | case _ => | |
81 | 102 | throw("Match error") | |
82 | 103 | } | |
83 | 104 | ||
84 | 105 | let usdtAssetId = valueOrErrorMessage(usdtAssetIdOption, wrapErr("invalid usdt asset id")) | |
85 | 106 | ||
86 | 107 | let kPricesAddress = "%s__calculatorAddress" | |
87 | 108 | ||
88 | 109 | let shutdown = valueOrElse(getBoolean(factoryAddress, kShutdown), false) | |
89 | 110 | ||
90 | 111 | func mustAddress (caller,address) = if ((caller == address)) | |
91 | 112 | then true | |
92 | 113 | else throwErr("permission denied") | |
93 | 114 | ||
94 | 115 | ||
95 | 116 | func mustThis (caller) = mustAddress(caller, this) | |
96 | 117 | ||
97 | 118 | ||
98 | 119 | func mustFactory (caller) = mustAddress(caller, factoryAddress) | |
99 | 120 | ||
100 | 121 | ||
101 | 122 | func mustAdmin (callerPublicKey) = { | |
102 | 123 | let multisig = addressFromStringValue(getStringValue(factoryAddress, kMultisig)) | |
103 | 124 | let publicKeysList = split(getStringValue(multisig, kPublicKeys), separator) | |
104 | 125 | if (containsElement(publicKeysList, toBase58String(callerPublicKey))) | |
105 | 126 | then true | |
106 | 127 | else throwErr("not allowed") | |
107 | 128 | } | |
108 | 129 | ||
109 | 130 | ||
110 | 131 | let kAccountScript = "%s__accountScript" | |
111 | 132 | ||
112 | 133 | func accountScript () = valueOrErrorMessage(getBinary(factoryAddress, kAccountScript), wrapErr("account script is not set")) | |
113 | 134 | ||
114 | 135 | ||
115 | 136 | let kRewardAmount = "%s__rewardAmount" | |
116 | 137 | ||
117 | 138 | func rewardAmount () = valueOrErrorMessage(getInteger(factoryAddress, kRewardAmount), wrapErr("reward amount is not set")) | |
118 | 139 | ||
119 | 140 | ||
120 | 141 | let kAccountsLimit = "%s__accountsLimit" | |
121 | 142 | ||
122 | 143 | let accountsLimitDefault = 20 | |
123 | 144 | ||
124 | 145 | func accountsLimit () = valueOrElse(getInteger(factoryAddress, kAccountsLimit), accountsLimitDefault) | |
125 | 146 | ||
126 | 147 | ||
127 | 148 | func kDeposited (accountAddress) = makeString(["%s%s", "deposited", toString(accountAddress)], separator) | |
128 | 149 | ||
129 | 150 | ||
130 | 151 | func depositedOption (accountAddress) = getInteger(factoryAddress, kDeposited(accountAddress)) | |
131 | 152 | ||
132 | 153 | ||
133 | 154 | func kCredit (accountAddress,assetId) = makeString(["%s%s%s", "credit", toString(accountAddress), assetIdToString(assetId)], separator) | |
134 | 155 | ||
135 | 156 | ||
136 | 157 | func kLeverage (accountAddress) = makeString(["%s%s", "leverage", toString(accountAddress)], separator) | |
137 | 158 | ||
138 | 159 | ||
139 | 160 | func kSyntheticAssetId (baseAssetId) = makeString(["%s%s", "syntheticAssetId", assetIdToString(baseAssetId)], separator) | |
140 | 161 | ||
141 | 162 | ||
142 | 163 | func kBaseAssetId (syntheticAssetId) = makeString(["%s%s", "baseAssetId", assetIdToString(syntheticAssetId)], separator) | |
143 | 164 | ||
144 | 165 | ||
145 | 166 | let REQUEST_STATUS_EMPTY = 0 | |
146 | 167 | ||
147 | 168 | let REQUEST_STATUS_READY = 1 | |
148 | 169 | ||
149 | 170 | func kRequestStatus (requestId) = makeString(["%s%s", toBase58String(requestId), "status"], separator) | |
150 | 171 | ||
151 | 172 | ||
152 | 173 | func kAccountCreatorPublicKey (accountAddress) = makeString(["%s%s", toString(accountAddress), "creatorPublicKey"], separator) | |
153 | 174 | ||
154 | 175 | ||
155 | 176 | func kRequestOwnerPublicKey (requestId) = makeString(["%s%s", toBase58String(requestId), "ownerPublicKey"], separator) | |
156 | 177 | ||
157 | 178 | ||
158 | 179 | func kRequestAmountAssetId (requestId) = makeString(["%s%s", toBase58String(requestId), "amountAssetId"], separator) | |
159 | 180 | ||
160 | 181 | ||
161 | 182 | func kRequestPriceAssetId (requestId) = makeString(["%s%s", toBase58String(requestId), "priceAssetId"], separator) | |
162 | 183 | ||
163 | 184 | ||
164 | 185 | func kRequestIdToAccountPublicKey (requestId) = makeString(["%s%s", toBase58String(requestId), "requestIdToAccountPublicKey"], separator) | |
165 | 186 | ||
166 | 187 | ||
167 | 188 | func kAccountAddressToRequestId (accountAddress) = makeString(["%s%s", toString(accountAddress), "accountAddressToRequestId"], separator) | |
168 | 189 | ||
169 | 190 | ||
170 | 191 | func kRequestsQueue () = makeString(["%s", "requestsQueue"], separator) | |
171 | 192 | ||
172 | 193 | ||
173 | 194 | func requestsQueue () = valueOrElse(getBinary(factoryAddress, kRequestsQueue()), base58'') | |
174 | 195 | ||
175 | 196 | ||
176 | 197 | func kAccountsQueue () = makeString(["%s", "accountsQueue"], separator) | |
177 | 198 | ||
178 | 199 | ||
179 | 200 | func accountsQueue () = valueOrElse(getBinary(factoryAddress, kAccountsQueue()), base58'') | |
180 | 201 | ||
181 | 202 | ||
182 | 203 | func kRequestsByOwner (ownerAddress) = makeString(["%s%s", "requests", toString(ownerAddress)], separator) | |
183 | 204 | ||
184 | 205 | ||
185 | 206 | func requestsByOwner (ownerAddress) = valueOrElse(getBinary(factoryAddress, kRequestsByOwner(ownerAddress)), base58'') | |
186 | 207 | ||
187 | 208 | ||
188 | 209 | func kPairAllowed (amountAssetId,priceAssetId) = makeString(["%s%s%s", assetIdToString(amountAssetId), assetIdToString(priceAssetId), "pairAllowed"], separator) | |
189 | 210 | ||
190 | 211 | ||
191 | 212 | func pairAllowed (amountAssetId,priceAssetId) = valueOrElse(getBoolean(factoryAddress, kPairAllowed(amountAssetId, priceAssetId)), false) | |
192 | 213 | ||
193 | 214 | ||
194 | 215 | func kPrice (assetId) = makeString(["%s", assetIdToString(assetId)], separator) | |
195 | 216 | ||
196 | 217 | ||
197 | 218 | func getCurrentPrice (assetId) = { | |
198 | 219 | let matcherPublicKey = fromBase58String(valueOrErrorMessage(getString(factoryAddress, kMatcherPublicKey), wrapErr("invalid matcher public key"))) | |
199 | 220 | let matcherAddress = addressFromPublicKey(matcherPublicKey) | |
200 | 221 | let price = valueOrErrorMessage(getInteger(matcherAddress, kPrice(assetId)), wrapErr(("invalid price, assetId = " + assetIdToString(assetId)))) | |
201 | 222 | price | |
202 | 223 | } | |
203 | 224 | ||
204 | 225 | ||
205 | - | func calcTotalCredit (creditA,creditB,currentPrice) = ((creditA | |
226 | + | func calcTotalCredit (creditA,creditB,currentPrice) = (fraction(creditA, currentPrice, mult18BigInt) + creditB) | |
206 | 227 | ||
207 | 228 | ||
208 | - | func calcTotalBalance (balanceA,balanceB,currentPrice) = ((balanceA | |
229 | + | func calcTotalBalance (balanceA,balanceB,currentPrice) = (fraction(balanceA, currentPrice, mult18BigInt) + balanceB) | |
209 | 230 | ||
210 | 231 | ||
211 | 232 | func calcPnl (totalBalance,totalCredit) = (totalBalance - totalCredit) | |
212 | 233 | ||
213 | 234 | ||
214 | - | func calcCreditAvailable (deposit,leverage,totalCredit) = ((deposit | |
235 | + | func calcCreditAvailable (deposit,leverage,totalCredit) = (fraction(deposit, leverage, mult18BigInt) - totalCredit) | |
215 | 236 | ||
216 | 237 | ||
217 | - | func calcRealInCredit (credit,balance) = if ((credit > | |
238 | + | func calcRealInCredit (credit,balance) = if ((credit > big0)) | |
218 | 239 | then (credit - balance) | |
219 | - | else | |
240 | + | else big0 | |
220 | 241 | ||
221 | 242 | ||
222 | - | func calcFree (credit,balance) = if ((credit > | |
243 | + | func calcFree (credit,balance) = if ((credit > big0)) | |
223 | 244 | then (balance - credit) | |
224 | - | else | |
245 | + | else big0 | |
225 | 246 | ||
226 | 247 | ||
227 | - | func calcShortPrice (free,realInCredit) = if ((realInCredit > | |
228 | - | then max([ | |
229 | - | else | |
248 | + | func calcShortPrice (free,realInCredit) = if ((realInCredit > big0)) | |
249 | + | then max([big0, fraction(free, mult18BigInt, realInCredit)]) | |
250 | + | else big0 | |
230 | 251 | ||
231 | 252 | ||
232 | - | func calcLongPrice (free,realInCredit) = if ((realInCredit > | |
233 | - | then max([ | |
234 | - | else | |
253 | + | func calcLongPrice (free,realInCredit) = if ((realInCredit > big0)) | |
254 | + | then max([big0, fraction(realInCredit, mult18BigInt, free)]) | |
255 | + | else big0 | |
235 | 256 | ||
236 | 257 | ||
237 | - | func calcStartMargin (realInCreditA,realInCreditB,currentPrice,settingsMargin) = (((realInCreditA | |
258 | + | func calcStartMargin (realInCreditA,realInCreditB,currentPrice,settingsMargin) = fraction((fraction(realInCreditA, currentPrice, mult18BigInt) + realInCreditB), settingsMargin, mult18BigInt) | |
238 | 259 | ||
239 | 260 | ||
240 | - | func calcMarginSupply (settingsMarginSupply,settingsMargin,startMargin) = | |
261 | + | func calcMarginSupply (settingsMarginSupply,settingsMargin,startMargin) = fraction(settingsMarginSupply, startMargin, settingsMargin) | |
241 | 262 | ||
242 | 263 | ||
243 | 264 | func calcLiquidationPrice (deposit,marginSupply,realInCreditA,realInCreditB,shortPrice,longPrice) = { | |
244 | 265 | let liquidationPriceA = if ((realInCreditA > 0)) | |
245 | 266 | then (((deposit - marginSupply) / realInCreditA) + shortPrice) | |
246 | 267 | else 0 | |
247 | 268 | let liquidationPriceB = if ((realInCreditB > 0)) | |
248 | 269 | then (longPrice - ((deposit - marginSupply) / (realInCreditA / longPrice))) | |
249 | 270 | else 0 | |
250 | 271 | (liquidationPriceA + liquidationPriceB) | |
251 | 272 | } | |
252 | 273 | ||
253 | 274 | ||
254 | 275 | func getAssetsByAccountAddress (accountAddress) = { | |
255 | 276 | let requestId = fromBase58String(valueOrErrorMessage(getString(factoryAddress, kAccountAddressToRequestId(accountAddress)), wrapErr("invalid account address"))) | |
256 | 277 | let amountAssetId = parseAssetId(valueOrErrorMessage(getString(factoryAddress, kRequestAmountAssetId(requestId)), wrapErr("invalid amount asset id"))) | |
257 | 278 | let priceAssetId = parseAssetId(valueOrErrorMessage(getString(factoryAddress, kRequestPriceAssetId(requestId)), wrapErr("invalid amount price id"))) | |
258 | 279 | $Tuple2(amountAssetId, priceAssetId) | |
259 | 280 | } | |
260 | 281 | ||
261 | 282 | ||
262 | 283 | @Callable(i) | |
263 | 284 | func init (factoryAddressStr) = { | |
264 | 285 | let checkCaller = mustThis(i.caller) | |
265 | 286 | if ((checkCaller == checkCaller)) | |
266 | 287 | then $Tuple2([StringEntry(kFactoryAddress, factoryAddressStr)], unit) | |
267 | 288 | else throw("Strict value is not equal to itself.") | |
268 | 289 | } | |
269 | 290 | ||
270 | 291 | ||
271 | 292 | ||
272 | 293 | @Callable(i) | |
273 | 294 | func requestAccount (callerPublicKey,args) = { | |
274 | 295 | let ckecks = [if (!(shutdown)) | |
275 | 296 | then true | |
276 | 297 | else throwErr("not allowed"), mustFactory(i.caller)] | |
277 | 298 | if ((ckecks == ckecks)) | |
278 | 299 | then { | |
279 | 300 | let amountAssetIdStr = args[0] | |
280 | 301 | let priceAssetIdStr = args[1] | |
281 | 302 | let userAddress = addressFromPublicKey(callerPublicKey) | |
282 | 303 | let requestId = sha256(((userAddress.bytes + fromBase58String(amountAssetIdStr)) + fromBase58String(priceAssetIdStr))) | |
283 | 304 | let amountAssetId = parseAssetId(amountAssetIdStr) | |
284 | 305 | let priceAssetId = parseAssetId(priceAssetIdStr) | |
285 | 306 | let userRequestsNumber = (size(kRequestsByOwner(userAddress)) / queueItemSize) | |
286 | 307 | let checks = [if ((size(i.payments) == 1)) | |
287 | 308 | then true | |
288 | 309 | else throwErr("1 payment is required"), if ((i.payments[0].assetId == unit)) | |
289 | 310 | then true | |
290 | 311 | else throwErr("invalid asset"), if ((i.payments[0].amount == rewardAmount())) | |
291 | 312 | then true | |
292 | 313 | else throwErr("invalid amount"), if (pairAllowed(amountAssetId, priceAssetId)) | |
293 | 314 | then true | |
294 | 315 | else throwErr("pair is not allowed"), if ((getInteger(factoryAddress, kRequestStatus(requestId)) == unit)) | |
295 | 316 | then true | |
296 | 317 | else throwErr("account is already exists"), if ((accountsLimit() > userRequestsNumber)) | |
297 | 318 | then true | |
298 | 319 | else throwErr(("accounts limit is " + toString(accountsLimit())))] | |
299 | 320 | if ((checks == checks)) | |
300 | 321 | then { | |
301 | - | let $ | |
322 | + | let $t01074712103 = if ((size(accountsQueue()) == 0)) | |
302 | 323 | then $Tuple2([ScriptTransfer(factoryAddress, rewardAmount(), unit)], [invoke(factoryAddress, "integerEntry", [kRequestStatus(requestId), REQUEST_STATUS_EMPTY], nil), invoke(factoryAddress, "binaryEntry", [kRequestsQueue(), (requestsQueue() + requestId)], nil)]) | |
303 | 324 | else { | |
304 | 325 | let accountPublicKey = take(accountsQueue(), queueItemSize) | |
305 | 326 | let accountAddress = addressFromPublicKey(accountPublicKey) | |
306 | 327 | let creatorAddress = addressFromPublicKey(valueOrErrorMessage(getBinary(factoryAddress, kAccountCreatorPublicKey(accountAddress)), wrapErr("invalid creator public key"))) | |
307 | 328 | $Tuple2([ScriptTransfer(creatorAddress, rewardAmount(), unit)], [invoke(factoryAddress, "binaryEntry", [kAccountsQueue(), drop(accountsQueue(), queueItemSize)], nil), invoke(factoryAddress, "integerEntry", [kRequestStatus(requestId), REQUEST_STATUS_READY], nil), invoke(factoryAddress, "binaryEntry", [kRequestIdToAccountPublicKey(requestId), accountPublicKey], nil), invoke(factoryAddress, "stringEntry", [kAccountAddressToRequestId(accountAddress), toBase58String(requestId)], nil)]) | |
308 | 329 | } | |
309 | - | let actions = $ | |
310 | - | let factoryActions = $ | |
330 | + | let actions = $t01074712103._1 | |
331 | + | let factoryActions = $t01074712103._2 | |
311 | 332 | $Tuple2(actions, (factoryActions ++ [invoke(factoryAddress, "binaryEntry", [kRequestOwnerPublicKey(requestId), callerPublicKey], nil), invoke(factoryAddress, "binaryEntry", [kRequestsByOwner(userAddress), (requestsByOwner(userAddress) + requestId)], nil), invoke(factoryAddress, "stringEntry", [kRequestAmountAssetId(requestId), amountAssetIdStr], nil), invoke(factoryAddress, "stringEntry", [kRequestPriceAssetId(requestId), priceAssetIdStr], nil)])) | |
312 | 333 | } | |
313 | 334 | else throw("Strict value is not equal to itself.") | |
314 | 335 | } | |
315 | 336 | else throw("Strict value is not equal to itself.") | |
316 | 337 | } | |
317 | 338 | ||
318 | 339 | ||
319 | 340 | ||
320 | 341 | @Callable(i) | |
321 | 342 | func addAccount (callerPublicKey,args) = { | |
322 | 343 | let ckecks = [if (!(shutdown)) | |
323 | 344 | then true | |
324 | 345 | else throwErr("not allowed"), mustFactory(i.caller)] | |
325 | 346 | if ((ckecks == ckecks)) | |
326 | 347 | then { | |
327 | 348 | let creatorPublicKey = fromBase58String(args[0]) | |
328 | 349 | let accountPublicKey = callerPublicKey | |
329 | 350 | let accountAddress = addressFromPublicKey(callerPublicKey) | |
330 | 351 | let creatorAddress = addressFromPublicKey(creatorPublicKey) | |
331 | 352 | let checks = [if ((getBinary(factoryAddress, kAccountCreatorPublicKey(accountAddress)) == unit)) | |
332 | 353 | then true | |
333 | 354 | else throwErr("account is already exists"), if ( match scriptHash(accountAddress) { | |
334 | 355 | case b: ByteVector => | |
335 | 356 | (b == blake2b256_32Kb(accountScript())) | |
336 | 357 | case _ => | |
337 | 358 | false | |
338 | 359 | }) | |
339 | 360 | then true | |
340 | 361 | else throwErr("invalid script")] | |
341 | 362 | if ((checks == checks)) | |
342 | 363 | then { | |
343 | - | let $ | |
364 | + | let $t01335814360 = if ((size(requestsQueue()) == 0)) | |
344 | 365 | then $Tuple2(nil, [invoke(factoryAddress, "binaryEntry", [kAccountsQueue(), (accountsQueue() + accountPublicKey)], nil)]) | |
345 | 366 | else { | |
346 | 367 | let requestId = take(requestsQueue(), queueItemSize) | |
347 | 368 | $Tuple2(nil, [invoke(factoryAddress, "integerEntry", [kRequestStatus(requestId), REQUEST_STATUS_READY], nil), invoke(factoryAddress, "binaryEntry", [kRequestIdToAccountPublicKey(requestId), accountPublicKey], nil), invoke(factoryAddress, "binaryEntry", [kRequestsQueue(), drop(requestsQueue(), queueItemSize)], nil), invoke(factoryAddress, "stringEntry", [kAccountAddressToRequestId(accountAddress), toBase58String(requestId)], nil), invoke(factoryAddress, "transferWaves", [creatorAddress.bytes, rewardAmount()], nil)]) | |
348 | 369 | } | |
349 | - | let actions = $ | |
350 | - | let factoryActions = $ | |
370 | + | let actions = $t01335814360._1 | |
371 | + | let factoryActions = $t01335814360._2 | |
351 | 372 | $Tuple2(actions, (factoryActions ++ [invoke(factoryAddress, "binaryEntry", [kAccountCreatorPublicKey(accountAddress), creatorPublicKey], nil)])) | |
352 | 373 | } | |
353 | 374 | else throw("Strict value is not equal to itself.") | |
354 | 375 | } | |
355 | 376 | else throw("Strict value is not equal to itself.") | |
356 | 377 | } | |
357 | 378 | ||
358 | 379 | ||
359 | 380 | ||
360 | 381 | @Callable(i) | |
361 | 382 | func deposit (callerPublicKey,args) = { | |
362 | 383 | let payment = i.payments[0] | |
363 | 384 | let ckecks = [if (!(shutdown)) | |
364 | 385 | then true | |
365 | 386 | else throwErr("not allowed"), mustFactory(i.caller), if ((size(i.payments) == 1)) | |
366 | 387 | then true | |
367 | 388 | else throwErr("1 payment is required"), if ((payment.assetId == usdtAssetId)) | |
368 | 389 | then true | |
369 | 390 | else throwErr("invalid asset")] | |
370 | 391 | if ((ckecks == ckecks)) | |
371 | 392 | then { | |
372 | 393 | let accountAddress = valueOrErrorMessage(addressFromString(args[0]), wrapErr("invalid account address")) | |
373 | 394 | let actions = [ScriptTransfer(accountAddress, payment.amount, payment.assetId)] | |
374 | 395 | let factoryActions = [invoke(factoryAddress, "integerEntry", [kDeposited(accountAddress), (valueOrElse(depositedOption(accountAddress), 0) + payment.amount)], nil)] | |
375 | 396 | $Tuple2(actions, factoryActions) | |
376 | 397 | } | |
377 | 398 | else throw("Strict value is not equal to itself.") | |
378 | 399 | } | |
379 | 400 | ||
380 | 401 | ||
381 | 402 | ||
382 | 403 | @Callable(i) | |
383 | 404 | func withdraw (callerPublicKey,args) = { | |
384 | 405 | let ckecks = [if (!(shutdown)) | |
385 | 406 | then true | |
386 | 407 | else throwErr("not allowed"), mustFactory(i.caller)] | |
387 | 408 | if ((ckecks == ckecks)) | |
388 | 409 | then { | |
389 | 410 | let userAddress = addressFromPublicKey(callerPublicKey) | |
390 | 411 | let accountAddress = valueOrErrorMessage(addressFromString(args[0]), wrapErr("invalid account address")) | |
391 | 412 | let amount = valueOrErrorMessage(parseInt(args[1]), wrapErr("invalid amount")) | |
392 | 413 | let assetId = parseAssetId(args[2]) | |
393 | 414 | let invocations = [invoke(accountAddress, "transferAsset", [userAddress.bytes, amount, assetId], nil)] | |
394 | 415 | $Tuple2(nil, invocations) | |
395 | 416 | } | |
396 | 417 | else throw("Strict value is not equal to itself.") | |
397 | 418 | } | |
398 | 419 | ||
399 | 420 | ||
400 | 421 | ||
401 | 422 | @Callable(i) | |
402 | 423 | func borrow (callerPublicKey,args) = { | |
403 | 424 | let ckecks = [if (!(shutdown)) | |
404 | 425 | then true | |
405 | 426 | else throwErr("not allowed"), mustFactory(i.caller)] | |
406 | 427 | if ((ckecks == ckecks)) | |
407 | 428 | then { | |
408 | 429 | let accountAddress = valueOrErrorMessage(addressFromString(args[0]), wrapErr("invalid account address")) | |
409 | 430 | let assetId = parseAssetId(args[1]) | |
410 | 431 | let amountRaw = parseInt(args[2]) | |
411 | - | let | |
412 | - | let | |
413 | - | let | |
414 | - | let | |
415 | - | let currentPrice = getCurrentPrice(amountAssetId) | |
416 | - | let creditA = valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, amountAssetId)), 0) | |
417 | - | let creditB = valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, priceAssetId)), 0) | |
432 | + | let $t01643516512 = getAssetsByAccountAddress(accountAddress) | |
433 | + | let amountAssetId = $t01643516512._1 | |
434 | + | let priceAssetId = $t01643516512._2 | |
435 | + | let deposited = toX18(valueOrElse(depositedOption(accountAddress), 0), pow10Decimals(priceAssetId)) | |
436 | + | let currentPrice = toX18(getCurrentPrice(amountAssetId), pow10Decimals(usdtAssetId)) | |
437 | + | let creditA = toX18(valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, amountAssetId)), 0), pow10Decimals(amountAssetId)) | |
438 | + | let creditB = toX18(valueOrElse(getInteger(factoryAddress, kCredit(accountAddress, priceAssetId)), 0), pow10Decimals(priceAssetId)) | |
418 | 439 | let totalCredit = calcTotalCredit(creditA, creditB, currentPrice) | |
419 | 440 | let leverageDefault = 3 | |
420 | - | let leverage = valueOrElse(getInteger(factoryAddress, kLeverage(accountAddress)), leverageDefault) | |
441 | + | let leverage = toX18(valueOrElse(getInteger(factoryAddress, kLeverage(accountAddress)), leverageDefault), 1) | |
421 | 442 | let creditAvailable = calcCreditAvailable(deposited, leverage, totalCredit) | |
422 | - | $Tuple2(nil, [creditAvailable]) | |
443 | + | $Tuple2(nil, [fromX18(creditAvailable, pow10Decimals(priceAssetId))]) | |
423 | 444 | } | |
424 | 445 | else throw("Strict value is not equal to itself.") | |
425 | 446 | } | |
426 | 447 | ||
427 | 448 | ||
428 | 449 | ||
429 | 450 | @Callable(i) | |
430 | 451 | func repay (callerPublicKey,args) = { | |
431 | 452 | let ckecks = [if (!(shutdown)) | |
432 | 453 | then true | |
433 | 454 | else throwErr("not allowed"), mustFactory(i.caller)] | |
434 | 455 | if ((ckecks == ckecks)) | |
435 | 456 | then $Tuple2(nil, unit) | |
436 | 457 | else throw("Strict value is not equal to itself.") | |
437 | 458 | } | |
438 | 459 | ||
439 | 460 | ||
440 | 461 | ||
441 | 462 | @Callable(i) | |
442 | 463 | func setPairAllowance (callerPublicKey,args) = { | |
443 | 464 | let ckecks = [if (!(shutdown)) | |
444 | 465 | then true | |
445 | 466 | else throwErr("not allowed"), mustFactory(i.caller), mustAdmin(callerPublicKey)] | |
446 | 467 | if ((ckecks == ckecks)) | |
447 | 468 | then { | |
448 | 469 | let amountAssetIdStr = args[0] | |
449 | 470 | let priceAssetIdStr = args[1] | |
450 | 471 | let allowStr = args[2] | |
451 | 472 | let amountAssetId = parseAssetId(amountAssetIdStr) | |
452 | 473 | let priceAssetId = parseAssetId(priceAssetIdStr) | |
453 | 474 | let allow = (allowStr == "true") | |
454 | 475 | let invocations = [invoke(factoryAddress, "booleanEntry", [kPairAllowed(amountAssetId, priceAssetId), allow], nil)] | |
455 | 476 | $Tuple2(nil, invocations) | |
456 | 477 | } | |
457 | 478 | else throw("Strict value is not equal to itself.") | |
458 | 479 | } | |
459 | 480 | ||
460 | 481 | ||
461 | 482 | ||
462 | 483 | @Callable(i) | |
463 | 484 | func addSyntheticAsset (callerPublicKey,args) = { | |
464 | 485 | let baseAssetIdStr = args[0] | |
465 | 486 | let baseAssetId = parseAssetId(baseAssetIdStr) | |
466 | 487 | let syntheticAssetId = i.payments[0].assetId | |
467 | 488 | let ckecks = [if (!(shutdown)) | |
468 | 489 | then true | |
469 | 490 | else throwErr("not allowed"), mustFactory(i.caller), mustAdmin(callerPublicKey), if ((getString(factoryAddress, kSyntheticAssetId(baseAssetId)) == unit)) | |
470 | 491 | then true | |
471 | 492 | else throwErr("invalid base asset"), if ((size(i.payments) == 1)) | |
472 | 493 | then true | |
473 | 494 | else throwErr("invalid payments"), if ((getString(factoryAddress, kBaseAssetId(syntheticAssetId)) == unit)) | |
474 | 495 | then true | |
475 | 496 | else throwErr("invalid synthetic asset")] | |
476 | 497 | if ((ckecks == ckecks)) | |
477 | 498 | then { | |
478 | 499 | let invocations = [invoke(factoryAddress, "stringEntry", [kSyntheticAssetId(baseAssetId), assetIdToString(syntheticAssetId)], nil), invoke(factoryAddress, "stringEntry", [kBaseAssetId(syntheticAssetId), assetIdToString(baseAssetId)], nil)] | |
479 | 500 | $Tuple2(nil, invocations) | |
480 | 501 | } | |
481 | 502 | else throw("Strict value is not equal to itself.") | |
482 | 503 | } | |
483 | 504 | ||
484 | 505 | ||
485 | 506 | ||
486 | 507 | @Callable(i) | |
487 | 508 | func doShutdown (callerPublicKey,args) = { | |
488 | 509 | let checks = [mustFactory(i.caller), mustAdmin(callerPublicKey)] | |
489 | 510 | if ((checks == checks)) | |
490 | 511 | then { | |
491 | 512 | let invocations = [invoke(factoryAddress, "booleanEntry", [kShutdown, true], nil)] | |
492 | 513 | $Tuple2(nil, invocations) | |
493 | 514 | } | |
494 | 515 | else throw("Strict value is not equal to itself.") | |
495 | 516 | } | |
496 | 517 | ||
497 | 518 | ||
498 | 519 | @Verifier(tx) | |
499 | 520 | func verify () = if (if (isDefined(factoryAddressOption)) | |
500 | 521 | then isDefined(getString(factoryAddress, kMultisig)) | |
501 | 522 | else false) | |
502 | 523 | then match getString(factoryAddress, kMultisig) { | |
503 | 524 | case multisig: String => | |
504 | 525 | let statusKey = kStatus(toString(this), toBase58String(tx.id)) | |
505 | 526 | let status = valueOrElse(getBoolean(addressFromStringValue(multisig), statusKey), false) | |
506 | 527 | status | |
507 | 528 | case _ => | |
508 | 529 | false | |
509 | 530 | } | |
510 | 531 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
511 | 532 |
github/deemru/w8io/169f3d6 66.92 ms ◑