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