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