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