tx · 5nqzJysKMrivpQNgoj1pFfYJZ53B7uuocMgcQvYiyUdi 3N8sfbgCJCsLbcWYRiVKm6ivccPLMsQmVDx: -0.02900000 Waves 2022.10.25 10:22 [2287615] smart account 3N8sfbgCJCsLbcWYRiVKm6ivccPLMsQmVDx > SELF 0.00000000 Waves
{ "type": 13, "id": "5nqzJysKMrivpQNgoj1pFfYJZ53B7uuocMgcQvYiyUdi", "fee": 2900000, "feeAssetId": null, "timestamp": 1666682183838, "version": 1, "sender": "3N8sfbgCJCsLbcWYRiVKm6ivccPLMsQmVDx", "senderPublicKey": "G4Ha5wvhDpHGy5koVJsmfWC2zwF89jXDUmWBb28mRyrr", "proofs": [ "V6WHnLgbBh28bNGHinaCbuspwd3D3vuVDPb6CGM2a2MUaCPCcVQS5oNnVbbQz5MfjbYv35bXD4Wt1U843awBmrt" ], "script": "base64:BgKyJwgCEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBAoCCAgSABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiEGlkeElQcmljZUFzc2V0SWQiDWlkeExQQXNzZXREY20iEmlk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mFsdWUBCAUCZUIGc2NyaXB0BAJmTgkA2wQBCQEFdmFsdWUBCQCdCAIFAmFDCQECYXEABAJmTwkA8QcBBQR0aGlzAwMJAAACBQJmTgUCZk0JAQIhPQIFAmZPBQJmTQcGCQD0AwMIBQJmSQlib2R5Qnl0ZXMJAJEDAggFAmZJBnByb29mcwAABQJmSwkA9AMDCAUCZkkJYm9keUJ5dGVzCQCRAwIIBQJmSQZwcm9vZnMAAAUCZkuSNT80", "chainId": 84, "height": 2287615, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9tsbf7YTHtHGhAtotbchW7e8H4KAnyMP6wDeXCBUr6oe Next: QfpmNKPJWg1k22oLKmLGV1PVVuBGbAfRqW76cQ7gf4r Diff:
Old | New | Differences | |
---|---|---|---|
508 | 508 | if ((chechSupply == chechSupply)) | |
509 | 509 | then { | |
510 | 510 | let depositBigInt = toBigInt(paymentAmount) | |
511 | - | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), | |
511 | + | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
512 | 512 | let commonState = if (isEval) | |
513 | 513 | then nil | |
514 | 514 | else [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
529 | 529 | ||
530 | 530 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
531 | 531 | let isEval = (txId == unit) | |
532 | - | let $ | |
533 | - | let poolAddress = $ | |
534 | - | let poolStatus = $ | |
535 | - | let lpAssetId = $ | |
536 | - | let amountAssetId = $ | |
537 | - | let priceAssetId = $ | |
538 | - | let amDecimals = $ | |
539 | - | let prDecimals = $ | |
532 | + | let $t02536425525 = parsePoolConfig(getPoolConfig()) | |
533 | + | let poolAddress = $t02536425525._1 | |
534 | + | let poolStatus = $t02536425525._2 | |
535 | + | let lpAssetId = $t02536425525._3 | |
536 | + | let amountAssetId = $t02536425525._4 | |
537 | + | let priceAssetId = $t02536425525._5 | |
538 | + | let amDecimals = $t02536425525._6 | |
539 | + | let prDecimals = $t02536425525._7 | |
540 | 540 | let checks = [if ((paymentAssetId == lpAssetId)) | |
541 | 541 | then true | |
542 | 542 | else throwErr("invalid lp asset")] | |
559 | 559 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(lpAssetId), (("asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity) | |
560 | 560 | let redeemedBigInt = toBigInt(paymentAmount) | |
561 | 561 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
562 | - | let $ | |
563 | - | let totalAmount = $ | |
564 | - | let feeAmount = $ | |
565 | - | let $ | |
562 | + | let $t02660026650 = takeFee(amountRaw) | |
563 | + | let totalAmount = $t02660026650._1 | |
564 | + | let feeAmount = $t02660026650._2 | |
565 | + | let $t02665426880 = if (outInAmountAsset) | |
566 | 566 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
567 | 567 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
568 | - | let outAmAmount = $ | |
569 | - | let outPrAmount = $ | |
570 | - | let amBalanceNew = $ | |
571 | - | let prBalanceNew = $ | |
568 | + | let outAmAmount = $t02665426880._1 | |
569 | + | let outPrAmount = $t02665426880._2 | |
570 | + | let amBalanceNew = $t02665426880._3 | |
571 | + | let prBalanceNew = $t02665426880._4 | |
572 | 572 | let curPrX18 = calcPriceBigInt(toX18(prBalanceNew, prDecimals), toX18(amBalanceNew, amDecimals)) | |
573 | 573 | let curPrice = fromX18(curPrX18, scale8) | |
574 | 574 | let commonState = if (isEval) | |
742 | 742 | let paymentAmountRaw = payment.amount | |
743 | 743 | let userAddress = i.caller | |
744 | 744 | let txId = i.transactionId | |
745 | - | let $ | |
746 | - | let emitAmountEstimated = $ | |
747 | - | let commonState = $ | |
748 | - | let feeAmount = $ | |
749 | - | let bonus = $ | |
745 | + | let $t03134731474 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
746 | + | let emitAmountEstimated = $t03134731474._1 | |
747 | + | let commonState = $t03134731474._2 | |
748 | + | let feeAmount = $t03134731474._3 | |
749 | + | let bonus = $t03134731474._4 | |
750 | 750 | let emitAmount = if (if ((minOutAmount > 0)) | |
751 | 751 | then (minOutAmount > emitAmountEstimated) | |
752 | 752 | else false) | |
777 | 777 | ||
778 | 778 | @Callable(i) | |
779 | 779 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
780 | - | let $ | |
781 | - | let emitAmountEstimated = $ | |
782 | - | let commonState = $ | |
783 | - | let feeAmount = $ | |
784 | - | let bonus = $ | |
780 | + | let $t03220332338 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
781 | + | let emitAmountEstimated = $t03220332338._1 | |
782 | + | let commonState = $t03220332338._2 | |
783 | + | let feeAmount = $t03220332338._3 | |
784 | + | let bonus = $t03220332338._4 | |
785 | 785 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
786 | 786 | } | |
787 | 787 | ||
805 | 805 | let paymentAmount = payment.amount | |
806 | 806 | let userAddress = i.caller | |
807 | 807 | let txId = i.transactionId | |
808 | - | let $ | |
809 | - | let amountEstimated = $ | |
810 | - | let commonState = $ | |
811 | - | let feeAmount = $ | |
812 | - | let bonus = $ | |
808 | + | let $t03292633058 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
809 | + | let amountEstimated = $t03292633058._1 | |
810 | + | let commonState = $t03292633058._2 | |
811 | + | let feeAmount = $t03292633058._3 | |
812 | + | let bonus = $t03292633058._4 | |
813 | 813 | let amount = if (if ((minOutAmount > 0)) | |
814 | 814 | then (minOutAmount > amountEstimated) | |
815 | 815 | else false) | |
833 | 833 | ||
834 | 834 | @Callable(i) | |
835 | 835 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
836 | - | let $ | |
837 | - | let amountEstimated = $ | |
838 | - | let commonState = $ | |
839 | - | let feeAmount = $ | |
840 | - | let bonus = $ | |
836 | + | let $t03369333831 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
837 | + | let amountEstimated = $t03369333831._1 | |
838 | + | let commonState = $t03369333831._2 | |
839 | + | let feeAmount = $t03369333831._3 | |
840 | + | let bonus = $t03369333831._4 | |
841 | 841 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
842 | 842 | } | |
843 | 843 | ||
859 | 859 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
860 | 860 | if ((unstakeInv == unstakeInv)) | |
861 | 861 | then { | |
862 | - | let $ | |
863 | - | let amountEstimated = $ | |
864 | - | let commonState = $ | |
865 | - | let feeAmount = $ | |
866 | - | let bonus = $ | |
862 | + | let $t03438134504 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, unit, unit) | |
863 | + | let amountEstimated = $t03438134504._1 | |
864 | + | let commonState = $t03438134504._2 | |
865 | + | let feeAmount = $t03438134504._3 | |
866 | + | let bonus = $t03438134504._4 | |
867 | 867 | let amount = if (if ((minOutAmount > 0)) | |
868 | 868 | then (minOutAmount > amountEstimated) | |
869 | 869 | else false) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let lPdecimals = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale8BigInt = toBigInt(100000000) | |
9 | 9 | ||
10 | 10 | let scale18 = toBigInt(1000000000000000000) | |
11 | 11 | ||
12 | 12 | let zeroBigInt = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big0 = toBigInt(0) | |
15 | 15 | ||
16 | 16 | let big1 = toBigInt(1) | |
17 | 17 | ||
18 | 18 | let big2 = toBigInt(2) | |
19 | 19 | ||
20 | 20 | let wavesString = "WAVES" | |
21 | 21 | ||
22 | 22 | let SEP = "__" | |
23 | 23 | ||
24 | 24 | let PoolActive = 1 | |
25 | 25 | ||
26 | 26 | let PoolPutDisabled = 2 | |
27 | 27 | ||
28 | 28 | let PoolMatcherDisabled = 3 | |
29 | 29 | ||
30 | 30 | let PoolShutdown = 4 | |
31 | 31 | ||
32 | 32 | let idxPoolAddress = 1 | |
33 | 33 | ||
34 | 34 | let idxPoolStatus = 2 | |
35 | 35 | ||
36 | 36 | let idxPoolLPAssetId = 3 | |
37 | 37 | ||
38 | 38 | let idxAmtAssetId = 4 | |
39 | 39 | ||
40 | 40 | let idxPriceAssetId = 5 | |
41 | 41 | ||
42 | 42 | let idxAmtAssetDcm = 6 | |
43 | 43 | ||
44 | 44 | let idxPriceAssetDcm = 7 | |
45 | 45 | ||
46 | 46 | let idxIAmtAssetId = 8 | |
47 | 47 | ||
48 | 48 | let idxIPriceAssetId = 9 | |
49 | 49 | ||
50 | 50 | let idxLPAssetDcm = 10 | |
51 | 51 | ||
52 | 52 | let idxPoolAmtAssetAmt = 1 | |
53 | 53 | ||
54 | 54 | let idxPoolPriceAssetAmt = 2 | |
55 | 55 | ||
56 | 56 | let idxPoolLPAssetAmt = 3 | |
57 | 57 | ||
58 | 58 | let idxFactoryStakingContract = 1 | |
59 | 59 | ||
60 | 60 | let idxFactorySlippageContract = 7 | |
61 | 61 | ||
62 | 62 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func abs (val) = if ((zeroBigInt > val)) | |
72 | 72 | then -(val) | |
73 | 73 | else val | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func fc () = "%s__factoryContract" | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func mpk () = "%s__managerPublicKey" | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func pmpk () = "%s__pendingManagerPublicKey" | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func pl () = "%s%s__price__last" | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func aa () = "%s__amountAsset" | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func pa () = "%s__priceAsset" | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let keyFee = "%s__fee" | |
104 | 104 | ||
105 | 105 | let feeDefault = fraction(5, scale8, 10000) | |
106 | 106 | ||
107 | 107 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
108 | 108 | ||
109 | 109 | func keyFactoryConfig () = "%s__factoryConfig" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func keyAllPoolsShutdown () = "%s__shutdown" | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | let keyFeeCollectorAddress = "%s__feeCollectorAddress" | |
134 | 134 | ||
135 | 135 | func throwOrderError (orderValid,senderValid,matcherValid) = throw(((((("order validation failed: orderValid=" + toString(orderValid)) + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func throwErr (msg) = throw(makeString(["lp.ride:", msg], " ")) | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | let factoryContract = addressFromStringValue(getStringOrFail(this, fc())) | |
148 | 148 | ||
149 | 149 | let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress)) | |
150 | 150 | ||
151 | 151 | func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false) | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub())) | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func getPoolConfig () = { | |
158 | 158 | let amtAsset = getStringOrFail(this, aa()) | |
159 | 159 | let priceAsset = getStringOrFail(this, pa()) | |
160 | 160 | let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset)) | |
161 | 161 | let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset)) | |
162 | 162 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP) | |
163 | 163 | } | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func parseAssetId (input) = if ((input == wavesString)) | |
167 | 167 | then unit | |
168 | 168 | else fromBase58String(input) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func assetIdToString (input) = if ((input == unit)) | |
172 | 172 | then wavesString | |
173 | 173 | else toBase58String(value(input)) | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolStatus]), fromBase58String(poolConfig[idxPoolLPAssetId]), parseAssetId(poolConfig[idxAmtAssetId]), parseAssetId(poolConfig[idxPriceAssetId]), parseIntValue(poolConfig[idxAmtAssetDcm]), parseIntValue(poolConfig[idxPriceAssetDcm])) | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | let poolConfigParsed = parsePoolConfig(getPoolConfig()) | |
180 | 180 | ||
181 | 181 | let $t074847650 = poolConfigParsed | |
182 | 182 | ||
183 | 183 | let cfgPoolAddress = $t074847650._1 | |
184 | 184 | ||
185 | 185 | let cfgPoolStatus = $t074847650._2 | |
186 | 186 | ||
187 | 187 | let cfgLpAssetId = $t074847650._3 | |
188 | 188 | ||
189 | 189 | let cfgAmountAssetId = $t074847650._4 | |
190 | 190 | ||
191 | 191 | let cfgPriceAssetId = $t074847650._5 | |
192 | 192 | ||
193 | 193 | let cfgAmountAssetDecimals = $t074847650._6 | |
194 | 194 | ||
195 | 195 | let cfgPriceAssetDecimals = $t074847650._7 | |
196 | 196 | ||
197 | 197 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
198 | 198 | ||
199 | 199 | ||
200 | 200 | let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address") | |
201 | 201 | ||
202 | 202 | let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address") | |
203 | 203 | ||
204 | 204 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slippageTolerancePassedByUser,slippageToleranceReal,txHeight,txTimestamp,slipageAmtAssetAmt,slipagePriceAssetAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slippageTolerancePassedByUser), toString(slippageToleranceReal), toString(txHeight), toString(txTimestamp), toString(slipageAmtAssetAmt), toString(slipagePriceAssetAmt)], SEP) | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | func dataGetActionInfo (outAmtAssetAmt,outPriceAssetAmt,inLpAmt,price,txHeight,txTimestamp) = makeString(["%d%d%d%d%d%d", toString(outAmtAssetAmt), toString(outPriceAssetAmt), toString(inLpAmt), toString(price), toString(txHeight), toString(txTimestamp)], SEP) | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
211 | 211 | then wavesBalance(this).available | |
212 | 212 | else assetBalance(this, fromBase58String(assetId)) | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
219 | 219 | let amtAssetAmtX18 = toX18(amAmt, amAssetDcm) | |
220 | 220 | let priceAssetAmtX18 = toX18(prAmt, prAssetDcm) | |
221 | 221 | calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
226 | 226 | let cfg = getPoolConfig() | |
227 | 227 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
228 | 228 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
229 | 229 | let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt) | |
230 | 230 | let amAmtX18 = toX18(amAmt, amtAssetDcm) | |
231 | 231 | let prAmtX18 = toX18(prAmt, priceAssetDcm) | |
232 | 232 | let lpAmtX18 = toX18(lpAmt, scale8) | |
233 | 233 | let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18) | |
234 | 234 | let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18) | |
235 | 235 | [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18] | |
236 | 236 | } | |
237 | 237 | ||
238 | 238 | ||
239 | 239 | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
240 | 240 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
241 | 241 | [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)] | |
242 | 242 | } | |
243 | 243 | ||
244 | 244 | ||
245 | 245 | func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
246 | 246 | let cfg = getPoolConfig() | |
247 | 247 | let lpAssetId = cfg[idxPoolLPAssetId] | |
248 | 248 | let amAssetId = cfg[idxAmtAssetId] | |
249 | 249 | let prAssetId = cfg[idxPriceAssetId] | |
250 | 250 | let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
251 | 251 | let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
252 | 252 | let poolStatus = cfg[idxPoolStatus] | |
253 | 253 | let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity | |
254 | 254 | if ((lpAssetId != pmtAssetId)) | |
255 | 255 | then throw("Invalid asset passed.") | |
256 | 256 | else { | |
257 | 257 | let amBalance = getAccBalance(amAssetId) | |
258 | 258 | let amBalanceX18 = toX18(amBalance, amAssetDcm) | |
259 | 259 | let prBalance = getAccBalance(prAssetId) | |
260 | 260 | let prBalanceX18 = toX18(prBalance, prAssetDcm) | |
261 | 261 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
262 | 262 | let curPrice = fromX18(curPriceX18, scale8) | |
263 | 263 | let pmtLpAmtX18 = toX18(pmtLpAmt, scale8) | |
264 | 264 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
265 | 265 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
266 | 266 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18) | |
267 | 267 | let outAmAmt = fromX18(outAmAmtX18, amAssetDcm) | |
268 | 268 | let outPrAmt = fromX18(outPrAmtX18, prAssetDcm) | |
269 | 269 | let state = if ((txId58 == "")) | |
270 | 270 | then nil | |
271 | 271 | else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES")) | |
272 | 272 | then unit | |
273 | 273 | else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES")) | |
274 | 274 | then unit | |
275 | 275 | else fromBase58String(prAssetId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
276 | 276 | $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state) | |
277 | 277 | } | |
278 | 278 | } | |
279 | 279 | ||
280 | 280 | ||
281 | 281 | func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = { | |
282 | 282 | let cfg = getPoolConfig() | |
283 | 283 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
284 | 284 | let amAssetIdStr = cfg[idxAmtAssetId] | |
285 | 285 | let prAssetIdStr = cfg[idxPriceAssetId] | |
286 | 286 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
287 | 287 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
288 | 288 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
289 | 289 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
290 | 290 | let poolStatus = cfg[idxPoolStatus] | |
291 | 291 | let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
292 | 292 | let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES"))) | |
293 | 293 | let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES"))) | |
294 | 294 | if (if ((amAssetIdStr != inAmAssetIdStr)) | |
295 | 295 | then true | |
296 | 296 | else (prAssetIdStr != inPrAssetIdStr)) | |
297 | 297 | then throw("Invalid amt or price asset passed.") | |
298 | 298 | else { | |
299 | 299 | let amBalance = if (isEvaluate) | |
300 | 300 | then getAccBalance(amAssetIdStr) | |
301 | 301 | else (getAccBalance(amAssetIdStr) - inAmAssetAmt) | |
302 | 302 | let prBalance = if (isEvaluate) | |
303 | 303 | then getAccBalance(prAssetIdStr) | |
304 | 304 | else (getAccBalance(prAssetIdStr) - inPrAssetAmt) | |
305 | 305 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
306 | 306 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
307 | 307 | let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18) | |
308 | 308 | let amBalanceX18 = toX18(amBalance, amtAssetDcm) | |
309 | 309 | let prBalanceX18 = toX18(prBalance, priceAssetDcm) | |
310 | 310 | let res = if ((lpEmission == 0)) | |
311 | 311 | then { | |
312 | 312 | let curPriceX18 = zeroBigInt | |
313 | 313 | let slippageX18 = zeroBigInt | |
314 | 314 | let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN) | |
315 | 315 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
316 | 316 | } | |
317 | 317 | else { | |
318 | 318 | let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18) | |
319 | 319 | let slippageX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
320 | 320 | let slippageToleranceX18 = toX18(slippageTolerance, scale8) | |
321 | 321 | if (if ((curPriceX18 != zeroBigInt)) | |
322 | 322 | then (slippageX18 > slippageToleranceX18) | |
323 | 323 | else false) | |
324 | 324 | then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18))) | |
325 | 325 | else { | |
326 | 326 | let lpEmissionX18 = toX18(lpEmission, scale8) | |
327 | 327 | let prViaAmX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
328 | 328 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
329 | 329 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
330 | 330 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
331 | 331 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
332 | 332 | let expAmtAssetAmtX18 = expectedAmts._1 | |
333 | 333 | let expPriceAssetAmtX18 = expectedAmts._2 | |
334 | 334 | let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18) | |
335 | 335 | $Tuple5(fromX18(lpAmtX18, scale8), fromX18(expAmtAssetAmtX18, amtAssetDcm), fromX18(expPriceAssetAmtX18, priceAssetDcm), curPriceX18, slippageX18) | |
336 | 336 | } | |
337 | 337 | } | |
338 | 338 | let calcLpAmt = res._1 | |
339 | 339 | let calcAmAssetPmt = res._2 | |
340 | 340 | let calcPrAssetPmt = res._3 | |
341 | 341 | let curPrice = fromX18(res._4, scale8) | |
342 | 342 | let slippageCalc = fromX18(res._5, scale8) | |
343 | 343 | if ((0 >= calcLpAmt)) | |
344 | 344 | then throw("Invalid calculations. LP calculated is less than zero.") | |
345 | 345 | else { | |
346 | 346 | let emitLpAmt = if (!(emitLp)) | |
347 | 347 | then 0 | |
348 | 348 | else calcLpAmt | |
349 | 349 | let amDiff = (inAmAssetAmt - calcAmAssetPmt) | |
350 | 350 | let prDiff = (inPrAssetAmt - calcPrAssetPmt) | |
351 | 351 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(calcAmAssetPmt, calcPrAssetPmt, emitLpAmt, curPrice, slippageTolerance, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
352 | 352 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId) | |
353 | 353 | } | |
354 | 354 | } | |
355 | 355 | } | |
356 | 356 | ||
357 | 357 | ||
358 | 358 | func validateMatcherOrderAllowed (order) = { | |
359 | 359 | let cfg = getPoolConfig() | |
360 | 360 | let amtAssetId = cfg[idxAmtAssetId] | |
361 | 361 | let priceAssetId = cfg[idxPriceAssetId] | |
362 | 362 | let poolStatus = parseIntValue(cfg[idxPoolStatus]) | |
363 | 363 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
364 | 364 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
365 | 365 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
366 | 366 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
367 | 367 | let curPriceX18 = if ((order.orderType == Buy)) | |
368 | 368 | then privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance + order.amount), accPriceAssetBalance) | |
369 | 369 | else privateCalcPrice(amtAssetDcm, priceAssetDcm, (accAmtAssetBalance - order.amount), accPriceAssetBalance) | |
370 | 370 | let curPrice = fromX18(curPriceX18, scale8) | |
371 | 371 | if (if (if (isGlobalShutdown()) | |
372 | 372 | then true | |
373 | 373 | else (poolStatus == PoolMatcherDisabled)) | |
374 | 374 | then true | |
375 | 375 | else (poolStatus == PoolShutdown)) | |
376 | 376 | then throw("Exchange operations disabled") | |
377 | 377 | else { | |
378 | 378 | let orderAmtAsset = order.assetPair.amountAsset | |
379 | 379 | let orderAmtAssetStr = if ((orderAmtAsset == unit)) | |
380 | 380 | then "WAVES" | |
381 | 381 | else toBase58String(value(orderAmtAsset)) | |
382 | 382 | let orderPriceAsset = order.assetPair.priceAsset | |
383 | 383 | let orderPriceAssetStr = if ((orderPriceAsset == unit)) | |
384 | 384 | then "WAVES" | |
385 | 385 | else toBase58String(value(orderPriceAsset)) | |
386 | 386 | if (if ((orderAmtAssetStr != amtAssetId)) | |
387 | 387 | then true | |
388 | 388 | else (orderPriceAssetStr != priceAssetId)) | |
389 | 389 | then throw("Wrong order assets.") | |
390 | 390 | else { | |
391 | 391 | let orderPrice = order.price | |
392 | 392 | let priceDcm = fraction(scale8, priceAssetDcm, amtAssetDcm) | |
393 | 393 | let castedOrderPrice = toScale(orderPrice, scale8, priceDcm) | |
394 | 394 | let isOrderPriceValid = if ((order.orderType == Buy)) | |
395 | 395 | then (curPrice >= castedOrderPrice) | |
396 | 396 | else (castedOrderPrice >= curPrice) | |
397 | 397 | true | |
398 | 398 | } | |
399 | 399 | } | |
400 | 400 | } | |
401 | 401 | ||
402 | 402 | ||
403 | 403 | func commonGet (i) = if ((size(i.payments) != 1)) | |
404 | 404 | then throw("exactly 1 payment is expected") | |
405 | 405 | else { | |
406 | 406 | let pmt = value(i.payments[0]) | |
407 | 407 | let pmtAssetId = value(pmt.assetId) | |
408 | 408 | let pmtAmt = pmt.amount | |
409 | 409 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
410 | 410 | let outAmAmt = res._1 | |
411 | 411 | let outPrAmt = res._2 | |
412 | 412 | let poolStatus = parseIntValue(res._9) | |
413 | 413 | let state = res._10 | |
414 | 414 | if (if (isGlobalShutdown()) | |
415 | 415 | then true | |
416 | 416 | else (poolStatus == PoolShutdown)) | |
417 | 417 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
418 | 418 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
419 | 419 | } | |
420 | 420 | ||
421 | 421 | ||
422 | 422 | func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2)) | |
423 | 423 | then throw("exactly 2 payments are expected") | |
424 | 424 | else { | |
425 | 425 | let amAssetPmt = value(i.payments[0]) | |
426 | 426 | let prAssetPmt = value(i.payments[1]) | |
427 | 427 | let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp) | |
428 | 428 | let poolStatus = parseIntValue(estPut._8) | |
429 | 429 | if (if (if (isGlobalShutdown()) | |
430 | 430 | then true | |
431 | 431 | else (poolStatus == PoolPutDisabled)) | |
432 | 432 | then true | |
433 | 433 | else (poolStatus == PoolShutdown)) | |
434 | 434 | then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus))) | |
435 | 435 | else estPut | |
436 | 436 | } | |
437 | 437 | ||
438 | 438 | ||
439 | 439 | func emit (amount) = { | |
440 | 440 | let emitInv = invoke(factoryContract, "emit", [amount], nil) | |
441 | 441 | if ((emitInv == emitInv)) | |
442 | 442 | then { | |
443 | 443 | let emitInvLegacy = match emitInv { | |
444 | 444 | case legacyFactoryContract: Address => | |
445 | 445 | invoke(legacyFactoryContract, "emit", [amount], nil) | |
446 | 446 | case _ => | |
447 | 447 | unit | |
448 | 448 | } | |
449 | 449 | if ((emitInvLegacy == emitInvLegacy)) | |
450 | 450 | then amount | |
451 | 451 | else throw("Strict value is not equal to itself.") | |
452 | 452 | } | |
453 | 453 | else throw("Strict value is not equal to itself.") | |
454 | 454 | } | |
455 | 455 | ||
456 | 456 | ||
457 | 457 | func takeFee (amount) = { | |
458 | 458 | let feeAmount = fraction(amount, fee, scale8) | |
459 | 459 | $Tuple2((amount - feeAmount), feeAmount) | |
460 | 460 | } | |
461 | 461 | ||
462 | 462 | ||
463 | 463 | func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = { | |
464 | 464 | let isEval = (txId == unit) | |
465 | 465 | let $t02216722345 = parsePoolConfig(getPoolConfig()) | |
466 | 466 | let poolAddress = $t02216722345._1 | |
467 | 467 | let poolStatus = $t02216722345._2 | |
468 | 468 | let lpAssetId = $t02216722345._3 | |
469 | 469 | let amountAssetId = $t02216722345._4 | |
470 | 470 | let priceAssetId = $t02216722345._5 | |
471 | 471 | let amountAssetDecimals = $t02216722345._6 | |
472 | 472 | let priceAssetDecimals = $t02216722345._7 | |
473 | 473 | let amountBalanceRaw = getAccBalance(assetIdToString(amountAssetId)) | |
474 | 474 | let priceBalanceRaw = getAccBalance(assetIdToString(priceAssetId)) | |
475 | 475 | let paymentInAmountAsset = if ((paymentAssetId == amountAssetId)) | |
476 | 476 | then true | |
477 | 477 | else if ((paymentAssetId == priceAssetId)) | |
478 | 478 | then false | |
479 | 479 | else throwErr("invalid asset") | |
480 | 480 | let $t02267522968 = if (isEval) | |
481 | 481 | then $Tuple2(amountBalanceRaw, priceBalanceRaw) | |
482 | 482 | else if (paymentInAmountAsset) | |
483 | 483 | then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw) | |
484 | 484 | else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw)) | |
485 | 485 | let amountBalanceOld = $t02267522968._1 | |
486 | 486 | let priceBalanceOld = $t02267522968._2 | |
487 | 487 | let $t02297223121 = if (paymentInAmountAsset) | |
488 | 488 | then $Tuple2(paymentAmountRaw, 0) | |
489 | 489 | else $Tuple2(0, paymentAmountRaw) | |
490 | 490 | let amountAssetAmountRaw = $t02297223121._1 | |
491 | 491 | let priceAssetAmountRaw = $t02297223121._2 | |
492 | 492 | let amountAssetAmount = takeFee(amountAssetAmountRaw)._1 | |
493 | 493 | let priceAssetAmount = takeFee(priceAssetAmountRaw)._1 | |
494 | 494 | let $t02324323302 = takeFee(paymentAmountRaw) | |
495 | 495 | let paymentAmount = $t02324323302._1 | |
496 | 496 | let feeAmount = $t02324323302._2 | |
497 | 497 | let amountBalanceNew = (amountBalanceOld + amountAssetAmount) | |
498 | 498 | let priceBalanceNew = (priceBalanceOld + priceAssetAmount) | |
499 | 499 | let curPrice = fromX18(calcPriceBigInt(toX18(priceBalanceNew, priceAssetDecimals), toX18(amountBalanceNew, amountAssetDecimals)), scale8) | |
500 | 500 | let paymentBalance = if (paymentInAmountAsset) | |
501 | 501 | then amountBalanceOld | |
502 | 502 | else priceBalanceOld | |
503 | 503 | let paymentBalanceBigInt = toBigInt(paymentBalance) | |
504 | 504 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(lpAssetId), (("asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity) | |
505 | 505 | let chechSupply = if ((supplyBigInt > big0)) | |
506 | 506 | then true | |
507 | 507 | else throwErr("initial deposit requires all coins") | |
508 | 508 | if ((chechSupply == chechSupply)) | |
509 | 509 | then { | |
510 | 510 | let depositBigInt = toBigInt(paymentAmount) | |
511 | - | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), | |
511 | + | let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))]) | |
512 | 512 | let commonState = if (isEval) | |
513 | 513 | then nil | |
514 | 514 | else [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(toString(value(userAddress)), toBase58String(value(txId))), dataPutActionInfo(amountAssetAmountRaw, priceAssetAmountRaw, issueAmount, curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
515 | 515 | let poolProportion = fraction(priceBalanceOld, scale8, amountBalanceOld) | |
516 | 516 | let amountAssetPart = fraction(paymentAmountRaw, scale8, (poolProportion + scale8)) | |
517 | 517 | let priceAssetPart = (paymentAmountRaw - amountAssetPart) | |
518 | 518 | let lpAmtBoth = toInt(fraction(supplyBigInt, toBigInt(priceAssetPart), toBigInt(priceBalanceOld))) | |
519 | 519 | let bonus = if ((lpAmtBoth == 0)) | |
520 | 520 | then if ((issueAmount == 0)) | |
521 | 521 | then 0 | |
522 | 522 | else throwErr("bonus calculation error") | |
523 | 523 | else fraction((issueAmount - lpAmtBoth), scale8, lpAmtBoth) | |
524 | 524 | $Tuple4(issueAmount, commonState, feeAmount, bonus) | |
525 | 525 | } | |
526 | 526 | else throw("Strict value is not equal to itself.") | |
527 | 527 | } | |
528 | 528 | ||
529 | 529 | ||
530 | 530 | func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = { | |
531 | 531 | let isEval = (txId == unit) | |
532 | - | let $ | |
533 | - | let poolAddress = $ | |
534 | - | let poolStatus = $ | |
535 | - | let lpAssetId = $ | |
536 | - | let amountAssetId = $ | |
537 | - | let priceAssetId = $ | |
538 | - | let amDecimals = $ | |
539 | - | let prDecimals = $ | |
532 | + | let $t02536425525 = parsePoolConfig(getPoolConfig()) | |
533 | + | let poolAddress = $t02536425525._1 | |
534 | + | let poolStatus = $t02536425525._2 | |
535 | + | let lpAssetId = $t02536425525._3 | |
536 | + | let amountAssetId = $t02536425525._4 | |
537 | + | let priceAssetId = $t02536425525._5 | |
538 | + | let amDecimals = $t02536425525._6 | |
539 | + | let prDecimals = $t02536425525._7 | |
540 | 540 | let checks = [if ((paymentAssetId == lpAssetId)) | |
541 | 541 | then true | |
542 | 542 | else throwErr("invalid lp asset")] | |
543 | 543 | if ((checks == checks)) | |
544 | 544 | then { | |
545 | 545 | let outInAmountAsset = if ((outAssetId == amountAssetId)) | |
546 | 546 | then true | |
547 | 547 | else if ((outAssetId == priceAssetId)) | |
548 | 548 | then false | |
549 | 549 | else throwErr("invalid asset") | |
550 | 550 | let balanceBigInt = if (outInAmountAsset) | |
551 | 551 | then toBigInt(getAccBalance(assetIdToString(amountAssetId))) | |
552 | 552 | else toBigInt(getAccBalance(assetIdToString(priceAssetId))) | |
553 | 553 | let amBalanceOld = getAccBalance(assetIdToString(amountAssetId)) | |
554 | 554 | let prBalanceOld = getAccBalance(assetIdToString(priceAssetId)) | |
555 | 555 | let outBalance = if (outInAmountAsset) | |
556 | 556 | then amBalanceOld | |
557 | 557 | else prBalanceOld | |
558 | 558 | let outBalanceBigInt = toBigInt(outBalance) | |
559 | 559 | let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(lpAssetId), (("asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity) | |
560 | 560 | let redeemedBigInt = toBigInt(paymentAmount) | |
561 | 561 | let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))]) | |
562 | - | let $ | |
563 | - | let totalAmount = $ | |
564 | - | let feeAmount = $ | |
565 | - | let $ | |
562 | + | let $t02660026650 = takeFee(amountRaw) | |
563 | + | let totalAmount = $t02660026650._1 | |
564 | + | let feeAmount = $t02660026650._2 | |
565 | + | let $t02665426880 = if (outInAmountAsset) | |
566 | 566 | then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld) | |
567 | 567 | else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw)) | |
568 | - | let outAmAmount = $ | |
569 | - | let outPrAmount = $ | |
570 | - | let amBalanceNew = $ | |
571 | - | let prBalanceNew = $ | |
568 | + | let outAmAmount = $t02665426880._1 | |
569 | + | let outPrAmount = $t02665426880._2 | |
570 | + | let amBalanceNew = $t02665426880._3 | |
571 | + | let prBalanceNew = $t02665426880._4 | |
572 | 572 | let curPrX18 = calcPriceBigInt(toX18(prBalanceNew, prDecimals), toX18(amBalanceNew, amDecimals)) | |
573 | 573 | let curPrice = fromX18(curPrX18, scale8) | |
574 | 574 | let commonState = if (isEval) | |
575 | 575 | then nil | |
576 | 576 | else [StringEntry(gau(toString(value(userAddress)), toBase58String(value(txId))), dataGetActionInfo(outAmAmount, outPrAmount, paymentAmount, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
577 | 577 | let r = estimateGetOperation("", assetIdToString(lpAssetId), paymentAmount, this) | |
578 | 578 | let sumOfGetAssets = (r._1 + r._2) | |
579 | 579 | let bonus = if ((sumOfGetAssets == 0)) | |
580 | 580 | then if ((totalAmount == 0)) | |
581 | 581 | then 0 | |
582 | 582 | else throwErr("bonus calculation error") | |
583 | 583 | else fraction((totalAmount - sumOfGetAssets), scale8, sumOfGetAssets) | |
584 | 584 | $Tuple4(totalAmount, commonState, feeAmount, bonus) | |
585 | 585 | } | |
586 | 586 | else throw("Strict value is not equal to itself.") | |
587 | 587 | } | |
588 | 588 | ||
589 | 589 | ||
590 | 590 | func managerPublicKeyOrUnit () = match getString(mpk()) { | |
591 | 591 | case s: String => | |
592 | 592 | fromBase58String(s) | |
593 | 593 | case _: Unit => | |
594 | 594 | unit | |
595 | 595 | case _ => | |
596 | 596 | throw("Match error") | |
597 | 597 | } | |
598 | 598 | ||
599 | 599 | ||
600 | 600 | func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) { | |
601 | 601 | case s: String => | |
602 | 602 | fromBase58String(s) | |
603 | 603 | case _: Unit => | |
604 | 604 | unit | |
605 | 605 | case _ => | |
606 | 606 | throw("Match error") | |
607 | 607 | } | |
608 | 608 | ||
609 | 609 | ||
610 | 610 | func mustManager (i) = { | |
611 | 611 | let pd = throw("Permission denied") | |
612 | 612 | match managerPublicKeyOrUnit() { | |
613 | 613 | case pk: ByteVector => | |
614 | 614 | if ((i.callerPublicKey == pk)) | |
615 | 615 | then true | |
616 | 616 | else pd | |
617 | 617 | case _: Unit => | |
618 | 618 | if ((i.caller == this)) | |
619 | 619 | then true | |
620 | 620 | else pd | |
621 | 621 | case _ => | |
622 | 622 | throw("Match error") | |
623 | 623 | } | |
624 | 624 | } | |
625 | 625 | ||
626 | 626 | ||
627 | 627 | @Callable(i) | |
628 | 628 | func setManager (pendingManagerPublicKey) = { | |
629 | 629 | let checkCaller = mustManager(i) | |
630 | 630 | if ((checkCaller == checkCaller)) | |
631 | 631 | then { | |
632 | 632 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
633 | 633 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
634 | 634 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
635 | 635 | else throw("Strict value is not equal to itself.") | |
636 | 636 | } | |
637 | 637 | else throw("Strict value is not equal to itself.") | |
638 | 638 | } | |
639 | 639 | ||
640 | 640 | ||
641 | 641 | ||
642 | 642 | @Callable(i) | |
643 | 643 | func confirmManager () = { | |
644 | 644 | let pm = pendingManagerPublicKeyOrUnit() | |
645 | 645 | let hasPM = if (isDefined(pm)) | |
646 | 646 | then true | |
647 | 647 | else throw("No pending manager") | |
648 | 648 | if ((hasPM == hasPM)) | |
649 | 649 | then { | |
650 | 650 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
651 | 651 | then true | |
652 | 652 | else throw("You are not pending manager") | |
653 | 653 | if ((checkPM == checkPM)) | |
654 | 654 | then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())] | |
655 | 655 | else throw("Strict value is not equal to itself.") | |
656 | 656 | } | |
657 | 657 | else throw("Strict value is not equal to itself.") | |
658 | 658 | } | |
659 | 659 | ||
660 | 660 | ||
661 | 661 | ||
662 | 662 | @Callable(i) | |
663 | 663 | func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance)) | |
664 | 664 | then throw("Invalid slippageTolerance passed") | |
665 | 665 | else { | |
666 | 666 | let estPut = commonPut(i, slippageTolerance, true) | |
667 | 667 | let emitLpAmt = estPut._2 | |
668 | 668 | let lpAssetId = estPut._7 | |
669 | 669 | let state = estPut._9 | |
670 | 670 | let amDiff = estPut._10 | |
671 | 671 | let prDiff = estPut._11 | |
672 | 672 | let amId = estPut._12 | |
673 | 673 | let prId = estPut._13 | |
674 | 674 | let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil) | |
675 | 675 | if ((emitInv == emitInv)) | |
676 | 676 | then { | |
677 | 677 | let emitInvLegacy = match emitInv { | |
678 | 678 | case legacyFactoryContract: Address => | |
679 | 679 | invoke(legacyFactoryContract, "emit", [emitLpAmt], nil) | |
680 | 680 | case _ => | |
681 | 681 | unit | |
682 | 682 | } | |
683 | 683 | if ((emitInvLegacy == emitInvLegacy)) | |
684 | 684 | then { | |
685 | 685 | let slippageAInv = if ((amDiff > 0)) | |
686 | 686 | then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)]) | |
687 | 687 | else nil | |
688 | 688 | if ((slippageAInv == slippageAInv)) | |
689 | 689 | then { | |
690 | 690 | let slippagePInv = if ((prDiff > 0)) | |
691 | 691 | then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)]) | |
692 | 692 | else nil | |
693 | 693 | if ((slippagePInv == slippagePInv)) | |
694 | 694 | then { | |
695 | 695 | let lpTransfer = if (shouldAutoStake) | |
696 | 696 | then { | |
697 | 697 | let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
698 | 698 | if ((slpStakeInv == slpStakeInv)) | |
699 | 699 | then nil | |
700 | 700 | else throw("Strict value is not equal to itself.") | |
701 | 701 | } | |
702 | 702 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
703 | 703 | (state ++ lpTransfer) | |
704 | 704 | } | |
705 | 705 | else throw("Strict value is not equal to itself.") | |
706 | 706 | } | |
707 | 707 | else throw("Strict value is not equal to itself.") | |
708 | 708 | } | |
709 | 709 | else throw("Strict value is not equal to itself.") | |
710 | 710 | } | |
711 | 711 | else throw("Strict value is not equal to itself.") | |
712 | 712 | } | |
713 | 713 | ||
714 | 714 | ||
715 | 715 | ||
716 | 716 | @Callable(i) | |
717 | 717 | func putForFree (maxSlippage) = if ((0 > maxSlippage)) | |
718 | 718 | then throw("Invalid value passed") | |
719 | 719 | else { | |
720 | 720 | let estPut = commonPut(i, maxSlippage, false) | |
721 | 721 | estPut._9 | |
722 | 722 | } | |
723 | 723 | ||
724 | 724 | ||
725 | 725 | ||
726 | 726 | @Callable(i) | |
727 | 727 | func putOneTkn (minOutAmount,autoStake) = { | |
728 | 728 | let isPutDisabled = if (if (isGlobalShutdown()) | |
729 | 729 | then true | |
730 | 730 | else (cfgPoolStatus == PoolPutDisabled)) | |
731 | 731 | then true | |
732 | 732 | else (cfgPoolStatus == PoolShutdown) | |
733 | 733 | let checks = [if (!(isPutDisabled)) | |
734 | 734 | then true | |
735 | 735 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
736 | 736 | then true | |
737 | 737 | else throwErr("exactly 1 payment are expected")] | |
738 | 738 | if ((checks == checks)) | |
739 | 739 | then { | |
740 | 740 | let payment = i.payments[0] | |
741 | 741 | let paymentAssetId = payment.assetId | |
742 | 742 | let paymentAmountRaw = payment.amount | |
743 | 743 | let userAddress = i.caller | |
744 | 744 | let txId = i.transactionId | |
745 | - | let $ | |
746 | - | let emitAmountEstimated = $ | |
747 | - | let commonState = $ | |
748 | - | let feeAmount = $ | |
749 | - | let bonus = $ | |
745 | + | let $t03134731474 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId) | |
746 | + | let emitAmountEstimated = $t03134731474._1 | |
747 | + | let commonState = $t03134731474._2 | |
748 | + | let feeAmount = $t03134731474._3 | |
749 | + | let bonus = $t03134731474._4 | |
750 | 750 | let emitAmount = if (if ((minOutAmount > 0)) | |
751 | 751 | then (minOutAmount > emitAmountEstimated) | |
752 | 752 | else false) | |
753 | 753 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
754 | 754 | else emitAmountEstimated | |
755 | 755 | let emitInv = emit(emitAmount) | |
756 | 756 | if ((emitInv == emitInv)) | |
757 | 757 | then { | |
758 | 758 | let lpTransfer = if (autoStake) | |
759 | 759 | then { | |
760 | 760 | let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)]) | |
761 | 761 | if ((stakeInv == stakeInv)) | |
762 | 762 | then nil | |
763 | 763 | else throw("Strict value is not equal to itself.") | |
764 | 764 | } | |
765 | 765 | else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)] | |
766 | 766 | let sendFee = if ((feeAmount > 0)) | |
767 | 767 | then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)] | |
768 | 768 | else nil | |
769 | 769 | $Tuple2(((commonState ++ lpTransfer) ++ sendFee), emitAmount) | |
770 | 770 | } | |
771 | 771 | else throw("Strict value is not equal to itself.") | |
772 | 772 | } | |
773 | 773 | else throw("Strict value is not equal to itself.") | |
774 | 774 | } | |
775 | 775 | ||
776 | 776 | ||
777 | 777 | ||
778 | 778 | @Callable(i) | |
779 | 779 | func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = { | |
780 | - | let $ | |
781 | - | let emitAmountEstimated = $ | |
782 | - | let commonState = $ | |
783 | - | let feeAmount = $ | |
784 | - | let bonus = $ | |
780 | + | let $t03220332338 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit) | |
781 | + | let emitAmountEstimated = $t03220332338._1 | |
782 | + | let commonState = $t03220332338._2 | |
783 | + | let feeAmount = $t03220332338._3 | |
784 | + | let bonus = $t03220332338._4 | |
785 | 785 | $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus)) | |
786 | 786 | } | |
787 | 787 | ||
788 | 788 | ||
789 | 789 | ||
790 | 790 | @Callable(i) | |
791 | 791 | func getOneTkn (outAssetIdStr,minOutAmount) = { | |
792 | 792 | let isGetDisabled = if (isGlobalShutdown()) | |
793 | 793 | then true | |
794 | 794 | else (cfgPoolStatus == PoolShutdown) | |
795 | 795 | let checks = [if (!(isGetDisabled)) | |
796 | 796 | then true | |
797 | 797 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
798 | 798 | then true | |
799 | 799 | else throwErr("exactly 1 payment are expected")] | |
800 | 800 | if ((checks == checks)) | |
801 | 801 | then { | |
802 | 802 | let outAssetId = parseAssetId(outAssetIdStr) | |
803 | 803 | let payment = i.payments[0] | |
804 | 804 | let paymentAssetId = payment.assetId | |
805 | 805 | let paymentAmount = payment.amount | |
806 | 806 | let userAddress = i.caller | |
807 | 807 | let txId = i.transactionId | |
808 | - | let $ | |
809 | - | let amountEstimated = $ | |
810 | - | let commonState = $ | |
811 | - | let feeAmount = $ | |
812 | - | let bonus = $ | |
808 | + | let $t03292633058 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId) | |
809 | + | let amountEstimated = $t03292633058._1 | |
810 | + | let commonState = $t03292633058._2 | |
811 | + | let feeAmount = $t03292633058._3 | |
812 | + | let bonus = $t03292633058._4 | |
813 | 813 | let amount = if (if ((minOutAmount > 0)) | |
814 | 814 | then (minOutAmount > amountEstimated) | |
815 | 815 | else false) | |
816 | 816 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
817 | 817 | else amountEstimated | |
818 | 818 | let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)]) | |
819 | 819 | if ((burnInv == burnInv)) | |
820 | 820 | then { | |
821 | 821 | let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)] | |
822 | 822 | let sendFee = if ((feeAmount > 0)) | |
823 | 823 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
824 | 824 | else nil | |
825 | 825 | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
826 | 826 | } | |
827 | 827 | else throw("Strict value is not equal to itself.") | |
828 | 828 | } | |
829 | 829 | else throw("Strict value is not equal to itself.") | |
830 | 830 | } | |
831 | 831 | ||
832 | 832 | ||
833 | 833 | ||
834 | 834 | @Callable(i) | |
835 | 835 | func getOneTknREADONLY (outAssetId,paymentAmount) = { | |
836 | - | let $ | |
837 | - | let amountEstimated = $ | |
838 | - | let commonState = $ | |
839 | - | let feeAmount = $ | |
840 | - | let bonus = $ | |
836 | + | let $t03369333831 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit) | |
837 | + | let amountEstimated = $t03369333831._1 | |
838 | + | let commonState = $t03369333831._2 | |
839 | + | let feeAmount = $t03369333831._3 | |
840 | + | let bonus = $t03369333831._4 | |
841 | 841 | $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus)) | |
842 | 842 | } | |
843 | 843 | ||
844 | 844 | ||
845 | 845 | ||
846 | 846 | @Callable(i) | |
847 | 847 | func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = { | |
848 | 848 | let isGetDisabled = if (isGlobalShutdown()) | |
849 | 849 | then true | |
850 | 850 | else (cfgPoolStatus == PoolShutdown) | |
851 | 851 | let checks = [if (!(isGetDisabled)) | |
852 | 852 | then true | |
853 | 853 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
854 | 854 | then true | |
855 | 855 | else throwErr("no payments are expected")] | |
856 | 856 | if ((checks == checks)) | |
857 | 857 | then { | |
858 | 858 | let outAssetId = parseAssetId(outAssetIdStr) | |
859 | 859 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
860 | 860 | if ((unstakeInv == unstakeInv)) | |
861 | 861 | then { | |
862 | - | let $ | |
863 | - | let amountEstimated = $ | |
864 | - | let commonState = $ | |
865 | - | let feeAmount = $ | |
866 | - | let bonus = $ | |
862 | + | let $t03438134504 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, unit, unit) | |
863 | + | let amountEstimated = $t03438134504._1 | |
864 | + | let commonState = $t03438134504._2 | |
865 | + | let feeAmount = $t03438134504._3 | |
866 | + | let bonus = $t03438134504._4 | |
867 | 867 | let amount = if (if ((minOutAmount > 0)) | |
868 | 868 | then (minOutAmount > amountEstimated) | |
869 | 869 | else false) | |
870 | 870 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
871 | 871 | else amountEstimated | |
872 | 872 | let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
873 | 873 | if ((burnInv == burnInv)) | |
874 | 874 | then { | |
875 | 875 | let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)] | |
876 | 876 | let sendFee = if ((feeAmount > 0)) | |
877 | 877 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)] | |
878 | 878 | else nil | |
879 | 879 | $Tuple2(((commonState ++ assetTransfer) ++ sendFee), amount) | |
880 | 880 | } | |
881 | 881 | else throw("Strict value is not equal to itself.") | |
882 | 882 | } | |
883 | 883 | else throw("Strict value is not equal to itself.") | |
884 | 884 | } | |
885 | 885 | else throw("Strict value is not equal to itself.") | |
886 | 886 | } | |
887 | 887 | ||
888 | 888 | ||
889 | 889 | ||
890 | 890 | @Callable(i) | |
891 | 891 | func get () = { | |
892 | 892 | let res = commonGet(i) | |
893 | 893 | let outAmtAmt = res._1 | |
894 | 894 | let outPrAmt = res._2 | |
895 | 895 | let pmtAmt = res._3 | |
896 | 896 | let pmtAssetId = res._4 | |
897 | 897 | let state = res._5 | |
898 | 898 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
899 | 899 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
900 | 900 | then state | |
901 | 901 | else throw("Strict value is not equal to itself.") | |
902 | 902 | } | |
903 | 903 | ||
904 | 904 | ||
905 | 905 | ||
906 | 906 | @Callable(i) | |
907 | 907 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
908 | 908 | let res = commonGet(i) | |
909 | 909 | let outAmAmt = res._1 | |
910 | 910 | let outPrAmt = res._2 | |
911 | 911 | let pmtAmt = res._3 | |
912 | 912 | let pmtAssetId = res._4 | |
913 | 913 | let state = res._5 | |
914 | 914 | if ((noLessThenAmtAsset > outAmAmt)) | |
915 | 915 | then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
916 | 916 | else if ((noLessThenPriceAsset > outPrAmt)) | |
917 | 917 | then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
918 | 918 | else { | |
919 | 919 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
920 | 920 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
921 | 921 | then state | |
922 | 922 | else throw("Strict value is not equal to itself.") | |
923 | 923 | } | |
924 | 924 | } | |
925 | 925 | ||
926 | 926 | ||
927 | 927 | ||
928 | 928 | @Callable(i) | |
929 | 929 | func unstakeAndGet (amount) = { | |
930 | 930 | let checkPayments = if ((size(i.payments) != 0)) | |
931 | 931 | then throw("No payments are expected") | |
932 | 932 | else true | |
933 | 933 | if ((checkPayments == checkPayments)) | |
934 | 934 | then { | |
935 | 935 | let cfg = getPoolConfig() | |
936 | 936 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
937 | 937 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil) | |
938 | 938 | if ((unstakeInv == unstakeInv)) | |
939 | 939 | then { | |
940 | 940 | let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
941 | 941 | let poolStatus = parseIntValue(res._9) | |
942 | 942 | let state = res._10 | |
943 | 943 | let checkPoolStatus = if (if (isGlobalShutdown()) | |
944 | 944 | then true | |
945 | 945 | else (poolStatus == PoolShutdown)) | |
946 | 946 | then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus))) | |
947 | 947 | else true | |
948 | 948 | if ((checkPoolStatus == checkPoolStatus)) | |
949 | 949 | then { | |
950 | 950 | let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
951 | 951 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
952 | 952 | then state | |
953 | 953 | else throw("Strict value is not equal to itself.") | |
954 | 954 | } | |
955 | 955 | else throw("Strict value is not equal to itself.") | |
956 | 956 | } | |
957 | 957 | else throw("Strict value is not equal to itself.") | |
958 | 958 | } | |
959 | 959 | else throw("Strict value is not equal to itself.") | |
960 | 960 | } | |
961 | 961 | ||
962 | 962 | ||
963 | 963 | ||
964 | 964 | @Callable(i) | |
965 | 965 | func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract))) | |
966 | 966 | then throw("permissions denied") | |
967 | 967 | else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success") | |
968 | 968 | ||
969 | 969 | ||
970 | 970 | ||
971 | 971 | @Callable(i) | |
972 | 972 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig()) | |
973 | 973 | ||
974 | 974 | ||
975 | 975 | ||
976 | 976 | @Callable(i) | |
977 | 977 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
978 | 978 | ||
979 | 979 | ||
980 | 980 | ||
981 | 981 | @Callable(i) | |
982 | 982 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
983 | 983 | let prices = calcPrices(amAmt, prAmt, lpAmt) | |
984 | 984 | $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])]) | |
985 | 985 | } | |
986 | 986 | ||
987 | 987 | ||
988 | 988 | ||
989 | 989 | @Callable(i) | |
990 | 990 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult))) | |
991 | 991 | ||
992 | 992 | ||
993 | 993 | ||
994 | 994 | @Callable(i) | |
995 | 995 | func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult)) | |
996 | 996 | ||
997 | 997 | ||
998 | 998 | ||
999 | 999 | @Callable(i) | |
1000 | 1000 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1001 | 1001 | ||
1002 | 1002 | ||
1003 | 1003 | ||
1004 | 1004 | @Callable(i) | |
1005 | 1005 | func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp)) | |
1006 | 1006 | ||
1007 | 1007 | ||
1008 | 1008 | ||
1009 | 1009 | @Callable(i) | |
1010 | 1010 | func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
1011 | 1011 | let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress)) | |
1012 | 1012 | $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10)) | |
1013 | 1013 | } | |
1014 | 1014 | ||
1015 | 1015 | ||
1016 | 1016 | ||
1017 | 1017 | @Callable(i) | |
1018 | 1018 | func statsREADONLY () = { | |
1019 | 1019 | let cfg = getPoolConfig() | |
1020 | 1020 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1021 | 1021 | let amtAssetId = cfg[idxAmtAssetId] | |
1022 | 1022 | let priceAssetId = cfg[idxPriceAssetId] | |
1023 | 1023 | let iAmtAssetId = cfg[idxIAmtAssetId] | |
1024 | 1024 | let iPriceAssetId = cfg[idxIPriceAssetId] | |
1025 | 1025 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1026 | 1026 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1027 | 1027 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1028 | 1028 | let accAmtAssetBalance = getAccBalance(amtAssetId) | |
1029 | 1029 | let accPriceAssetBalance = getAccBalance(priceAssetId) | |
1030 | 1030 | let pricesList = if ((poolLPBalance == 0)) | |
1031 | 1031 | then [zeroBigInt, zeroBigInt, zeroBigInt] | |
1032 | 1032 | else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance) | |
1033 | 1033 | let curPrice = 0 | |
1034 | 1034 | let lpAmtAssetShare = fromX18(pricesList[1], scale8) | |
1035 | 1035 | let lpPriceAssetShare = fromX18(pricesList[2], scale8) | |
1036 | 1036 | let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this)))) | |
1037 | 1037 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(accAmtAssetBalance), toString(accPriceAssetBalance), toString(poolLPBalance), toString(curPrice), toString(lpAmtAssetShare), toString(lpPriceAssetShare), toString(poolWeight)], SEP)) | |
1038 | 1038 | } | |
1039 | 1039 | ||
1040 | 1040 | ||
1041 | 1041 | ||
1042 | 1042 | @Callable(i) | |
1043 | 1043 | func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = { | |
1044 | 1044 | let cfg = getPoolConfig() | |
1045 | 1045 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1046 | 1046 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1047 | 1047 | let amAssetId = fromBase58String(amAssetIdStr) | |
1048 | 1048 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1049 | 1049 | let prAssetId = fromBase58String(prAssetIdStr) | |
1050 | 1050 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1051 | 1051 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1052 | 1052 | let poolStatus = cfg[idxPoolStatus] | |
1053 | 1053 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1054 | 1054 | let accAmtAssetBalance = getAccBalance(amAssetIdStr) | |
1055 | 1055 | let accPriceAssetBalance = getAccBalance(prAssetIdStr) | |
1056 | 1056 | let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm) | |
1057 | 1057 | let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm) | |
1058 | 1058 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1059 | 1059 | then zeroBigInt | |
1060 | 1060 | else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18) | |
1061 | 1061 | let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm) | |
1062 | 1062 | let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18) | |
1063 | 1063 | let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm) | |
1064 | 1064 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1065 | 1065 | let calcLpAmt = estPut._1 | |
1066 | 1066 | let curPriceCalc = estPut._3 | |
1067 | 1067 | let amBalance = estPut._4 | |
1068 | 1068 | let prBalance = estPut._5 | |
1069 | 1069 | let lpEmission = estPut._6 | |
1070 | 1070 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1071 | 1071 | } | |
1072 | 1072 | ||
1073 | 1073 | ||
1074 | 1074 | ||
1075 | 1075 | @Callable(i) | |
1076 | 1076 | func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = { | |
1077 | 1077 | let cfg = getPoolConfig() | |
1078 | 1078 | let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId]) | |
1079 | 1079 | let amAssetIdStr = cfg[idxAmtAssetId] | |
1080 | 1080 | let amAssetId = fromBase58String(amAssetIdStr) | |
1081 | 1081 | let prAssetIdStr = cfg[idxPriceAssetId] | |
1082 | 1082 | let prAssetId = fromBase58String(prAssetIdStr) | |
1083 | 1083 | let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm]) | |
1084 | 1084 | let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm]) | |
1085 | 1085 | let poolStatus = cfg[idxPoolStatus] | |
1086 | 1086 | let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity | |
1087 | 1087 | let amBalanceRaw = getAccBalance(amAssetIdStr) | |
1088 | 1088 | let prBalanceRaw = getAccBalance(prAssetIdStr) | |
1089 | 1089 | let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm) | |
1090 | 1090 | let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm) | |
1091 | 1091 | let curPriceX18 = if ((poolLPBalance == 0)) | |
1092 | 1092 | then zeroBigInt | |
1093 | 1093 | else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18) | |
1094 | 1094 | let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm) | |
1095 | 1095 | let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18) | |
1096 | 1096 | let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm) | |
1097 | 1097 | let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false) | |
1098 | 1098 | let calcLpAmt = estPut._1 | |
1099 | 1099 | let curPriceCalc = estPut._3 | |
1100 | 1100 | let amBalance = estPut._4 | |
1101 | 1101 | let prBalance = estPut._5 | |
1102 | 1102 | let lpEmission = estPut._6 | |
1103 | 1103 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d%d", toString(calcLpAmt), toString(fromX18(curPriceX18, scale8)), toString(amBalance), toString(prBalance), toString(lpEmission), poolStatus, toString(inAmAssetAmt), toString(inPrAssetAmt)], SEP)) | |
1104 | 1104 | } | |
1105 | 1105 | ||
1106 | 1106 | ||
1107 | 1107 | ||
1108 | 1108 | @Callable(i) | |
1109 | 1109 | func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = { | |
1110 | 1110 | let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this) | |
1111 | 1111 | let outAmAmt = res._1 | |
1112 | 1112 | let outPrAmt = res._2 | |
1113 | 1113 | let amBalance = res._5 | |
1114 | 1114 | let prBalance = res._6 | |
1115 | 1115 | let lpEmission = res._7 | |
1116 | 1116 | let curPrice = res._8 | |
1117 | 1117 | let poolStatus = parseIntValue(res._9) | |
1118 | 1118 | $Tuple2(nil, makeString(["%d%d%d%d%d%d%d", toString(outAmAmt), toString(outPrAmt), toString(amBalance), toString(prBalance), toString(lpEmission), toString(curPrice), toString(poolStatus)], SEP)) | |
1119 | 1119 | } | |
1120 | 1120 | ||
1121 | 1121 | ||
1122 | 1122 | @Verifier(tx) | |
1123 | 1123 | func verify () = { | |
1124 | 1124 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1125 | 1125 | case pk: ByteVector => | |
1126 | 1126 | pk | |
1127 | 1127 | case _: Unit => | |
1128 | 1128 | tx.senderPublicKey | |
1129 | 1129 | case _ => | |
1130 | 1130 | throw("Match error") | |
1131 | 1131 | } | |
1132 | 1132 | match tx { | |
1133 | 1133 | case order: Order => | |
1134 | 1134 | let matcherPub = getMatcherPubOrFail() | |
1135 | 1135 | let orderValid = validateMatcherOrderAllowed(order) | |
1136 | 1136 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1137 | 1137 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1138 | 1138 | if (if (if (orderValid) | |
1139 | 1139 | then senderValid | |
1140 | 1140 | else false) | |
1141 | 1141 | then matcherValid | |
1142 | 1142 | else false) | |
1143 | 1143 | then true | |
1144 | 1144 | else throwOrderError(orderValid, senderValid, matcherValid) | |
1145 | 1145 | case s: SetScriptTransaction => | |
1146 | 1146 | let newHash = blake2b256(value(s.script)) | |
1147 | 1147 | let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash()))) | |
1148 | 1148 | let currentHash = scriptHash(this) | |
1149 | 1149 | if (if ((allowedHash == newHash)) | |
1150 | 1150 | then (currentHash != newHash) | |
1151 | 1151 | else false) | |
1152 | 1152 | then true | |
1153 | 1153 | else sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1154 | 1154 | case _ => | |
1155 | 1155 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1156 | 1156 | } | |
1157 | 1157 | } | |
1158 | 1158 |
github/deemru/w8io/026f985 126.56 ms ◑