tx · 5c4WjjNNnut1mZH3e1jJrfo1fwgEvZdrHQVAzs8y4KXx 3N8aqXmsyH4LoDFyypgngYYKT49pQ8nB4dx: -0.08000000 Waves 2023.05.24 19:01 [2592271] smart account 3N8aqXmsyH4LoDFyypgngYYKT49pQ8nB4dx > SELF 0.00000000 Waves
{ "type": 13, "id": "5c4WjjNNnut1mZH3e1jJrfo1fwgEvZdrHQVAzs8y4KXx", "fee": 8000000, "feeAssetId": null, "timestamp": 1684944119446, "version": 2, "chainId": 84, "sender": "3N8aqXmsyH4LoDFyypgngYYKT49pQ8nB4dx", "senderPublicKey": "Hn75Ffw1pMKXcKvsGG5tJsFa7E4qyApSvkYUP4j8KDnN", "proofs": [ "3BWebvAMgfD6P4BCYUn51BsuyPnXxCqt51Hw9MRLzfip2hxQ4KQiHKJND6Hkve8rSB1YqH8r3bHowKivhdS5zTPa" ], "script": "base64:BgIzCAISABIAEgMKAQESBQoDAQEBEgkKBwEBCAgBAQESBAoCAQESBAoCAQESABIAEgASABIAPgAMa19iYXNlT3JhY2xlAgxrX2Jhc2VPcmFjbGUADWtfaW5pdGlhbGl6ZWQCDWtfaW5pdGlhbGl6ZWQACGtfcGF1c2VkAghrX3BhdXNlZAAFa19mZWUCBWtfZmVlABBrX21heFByaWNlSW1wYWN0AhBrX21heFByaWNlSW1wYWN0ABBrX21heFByaWNlU3ByZWFkAhBrX21heFByaWNlU3ByZWFkABBrX21heE9yYWNsZURlbGF5AhBrX21heE9yYWNsZURlbGF5ABNrX3F1b3RlQXNzZXRSZXNlcnZlAghrX3F0QXN0UgASa19iYXNlQXNzZXRSZXNlcnZlAghrX2JzQXN0UgASa19xdW90ZUFzc2V0V2VpZ2h0AghrX3F0QXN0VwARa19iYXNlQXNzZXRXZWlnaHQCCGtfYnNBc3RXABNrX3RvdGFsUG9zaXRpb25TaXplAhNrX3RvdGFsUG9zaXRpb25TaXplAAhrX2xhc3RUeAIIa19sYXN0VHgAFGtfY29vcmRpbmF0b3JBZGRyZXNz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0IAgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUOY29vcmRpbmF0b3JTdHIFD2tfYWRtaW5fYWRkcmVzcwMJAQlpc0RlZmluZWQBBQVhZG1pbgkBC3ZhbHVlT3JFbHNlAgkAmwgCCQERQGV4dHJOYXRpdmUoMTA2MikBCQEFdmFsdWUBBQVhZG1pbgkArAICCQCsAgIJAKwCAgIHc3RhdHVzXwkApQgBBQR0aGlzAgFfCQDYBAEIBQJ0eAJpZAcJAAIBAi51bmFibGUgdG8gdmVyaWZ5OiBhZG1pbiBub3Qgc2V0IGluIGNvb3JkaW5hdG9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5jfsDLw==", "height": 2592271, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 94qzdrAm6k7J16siRBJtnDT48zHbSiEUMC4dXCe1RUnd Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let k_baseOracle = "k_baseOracle" | |
5 | + | ||
6 | + | let k_initialized = "k_initialized" | |
7 | + | ||
8 | + | let k_paused = "k_paused" | |
9 | + | ||
10 | + | let k_fee = "k_fee" | |
11 | + | ||
12 | + | let k_maxPriceImpact = "k_maxPriceImpact" | |
13 | + | ||
14 | + | let k_maxPriceSpread = "k_maxPriceSpread" | |
15 | + | ||
16 | + | let k_maxOracleDelay = "k_maxOracleDelay" | |
17 | + | ||
18 | + | let k_quoteAssetReserve = "k_qtAstR" | |
19 | + | ||
20 | + | let k_baseAssetReserve = "k_bsAstR" | |
21 | + | ||
22 | + | let k_quoteAssetWeight = "k_qtAstW" | |
23 | + | ||
24 | + | let k_baseAssetWeight = "k_bsAstW" | |
25 | + | ||
26 | + | let k_totalPositionSize = "k_totalPositionSize" | |
27 | + | ||
28 | + | let k_lastTx = "k_lastTx" | |
29 | + | ||
30 | + | let k_coordinatorAddress = "k_coordinatorAddress" | |
31 | + | ||
32 | + | let k_vault_address = "k_vault_address" | |
33 | + | ||
34 | + | let k_admin_address = "k_admin_address" | |
35 | + | ||
36 | + | let k_quote_asset = "k_quote_asset" | |
37 | + | ||
38 | + | let k_spot_address = "k_spot_address" | |
39 | + | ||
40 | + | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
41 | + | ||
42 | + | ||
43 | + | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
44 | + | ||
45 | + | ||
46 | + | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
47 | + | ||
48 | + | ||
49 | + | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
50 | + | ||
51 | + | ||
52 | + | func spotAddress () = addressFromString(valueOrErrorMessage(getString(coordinator(), k_spot_address), "Spot address not set")) | |
53 | + | ||
54 | + | ||
55 | + | let DECIMAL_NUMBERS = 6 | |
56 | + | ||
57 | + | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
58 | + | ||
59 | + | func s (_x) = (toString(_x) + ",") | |
60 | + | ||
61 | + | ||
62 | + | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
63 | + | ||
64 | + | ||
65 | + | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
66 | + | ||
67 | + | ||
68 | + | func bdivd (_x,_y) = fraction(_x, toBigInt(DECIMAL_UNIT), _y, HALFEVEN) | |
69 | + | ||
70 | + | ||
71 | + | func bmuld (_x,_y) = fraction(_x, _y, toBigInt(DECIMAL_UNIT), HALFEVEN) | |
72 | + | ||
73 | + | ||
74 | + | func abs (_x) = if ((_x > 0)) | |
75 | + | then _x | |
76 | + | else -(_x) | |
77 | + | ||
78 | + | ||
79 | + | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
80 | + | ||
81 | + | ||
82 | + | func intOr (k,def) = valueOrElse(getInteger(this, k), def) | |
83 | + | ||
84 | + | ||
85 | + | func intA (_address,_key) = { | |
86 | + | let val = valueOrErrorMessage(getInteger(_address, _key), ("No value for key " + _key)) | |
87 | + | val | |
88 | + | } | |
89 | + | ||
90 | + | ||
91 | + | func fee () = int(k_fee) | |
92 | + | ||
93 | + | ||
94 | + | func qtAstR () = int(k_quoteAssetReserve) | |
95 | + | ||
96 | + | ||
97 | + | func bsAstR () = int(k_baseAssetReserve) | |
98 | + | ||
99 | + | ||
100 | + | func qtAstW () = intOr(k_quoteAssetWeight, DECIMAL_UNIT) | |
101 | + | ||
102 | + | ||
103 | + | func bsAstW () = intOr(k_baseAssetWeight, DECIMAL_UNIT) | |
104 | + | ||
105 | + | ||
106 | + | func totalPositionSize () = int(k_totalPositionSize) | |
107 | + | ||
108 | + | ||
109 | + | func maxPriceImpact () = int(k_maxPriceImpact) | |
110 | + | ||
111 | + | ||
112 | + | func maxPriceSpread () = int(k_maxPriceSpread) | |
113 | + | ||
114 | + | ||
115 | + | func maxOracleDelay () = int(k_maxOracleDelay) | |
116 | + | ||
117 | + | ||
118 | + | func lastTimestamp () = lastBlock.timestamp | |
119 | + | ||
120 | + | ||
121 | + | func getOracleData (key) = { | |
122 | + | let oracleDataStr = getString(this, key) | |
123 | + | if (if (isDefined(oracleDataStr)) | |
124 | + | then (value(oracleDataStr) != "") | |
125 | + | else false) | |
126 | + | then { | |
127 | + | let oracleData = split(value(oracleDataStr), ",") | |
128 | + | let oracleAddress = valueOrErrorMessage(addressFromString(oracleData[0]), ("Invalid oracle address in: " + value(oracleDataStr))) | |
129 | + | let priceKey = oracleData[1] | |
130 | + | let blockKey = oracleData[2] | |
131 | + | let openKey = oracleData[3] | |
132 | + | $Tuple4(oracleAddress, priceKey, blockKey, openKey) | |
133 | + | } | |
134 | + | else unit | |
135 | + | } | |
136 | + | ||
137 | + | ||
138 | + | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
139 | + | ||
140 | + | ||
141 | + | func paused () = valueOrElse(getBoolean(this, k_paused), false) | |
142 | + | ||
143 | + | ||
144 | + | func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd) | |
145 | + | then { | |
146 | + | let newBase = (bsAstR() - _baseAssetAmount) | |
147 | + | if ((0 >= newBase)) | |
148 | + | then throw("Tx lead to base asset reserve <= 0, revert") | |
149 | + | else $Tuple3((qtAstR() + _quoteAssetAmount), newBase, (totalPositionSize() + _baseAssetAmount)) | |
150 | + | } | |
151 | + | else { | |
152 | + | let newQuote = (qtAstR() - _quoteAssetAmount) | |
153 | + | if ((0 >= newQuote)) | |
154 | + | then throw("Tx lead to base quote reserve <= 0, revert") | |
155 | + | else $Tuple3(newQuote, (bsAstR() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount)) | |
156 | + | } | |
157 | + | ||
158 | + | ||
159 | + | func calcInvariant (_qtAstR,_bsAstR) = { | |
160 | + | let bqtAstR = toBigInt(_qtAstR) | |
161 | + | let bbsAstR = toBigInt(_bsAstR) | |
162 | + | bmuld(bqtAstR, bbsAstR) | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | func swapInput (_isAdd,_quoteAssetAmount) = { | |
167 | + | let _qtAstR = qtAstR() | |
168 | + | let _bsAstR = bsAstR() | |
169 | + | let _qtAstW = qtAstW() | |
170 | + | let _bsAstW = bsAstW() | |
171 | + | let quoteAssetAmountAdjusted = divd(_quoteAssetAmount, _qtAstW) | |
172 | + | let k = calcInvariant(_qtAstR, _bsAstR) | |
173 | + | let quoteAssetReserveAfter = if (_isAdd) | |
174 | + | then (_qtAstR + quoteAssetAmountAdjusted) | |
175 | + | else (_qtAstR - quoteAssetAmountAdjusted) | |
176 | + | let baseAssetReserveAfter = toInt(bdivd(k, toBigInt(quoteAssetReserveAfter))) | |
177 | + | let amountBaseAssetBoughtAbs = abs((baseAssetReserveAfter - _bsAstR)) | |
178 | + | let amountBaseAssetBought = if (_isAdd) | |
179 | + | then amountBaseAssetBoughtAbs | |
180 | + | else -(amountBaseAssetBoughtAbs) | |
181 | + | let $t064066576 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs) | |
182 | + | let quoteAssetReserveAfter1 = $t064066576._1 | |
183 | + | let baseAssetReserveAfter1 = $t064066576._2 | |
184 | + | let totalPositionSizeAfter1 = $t064066576._3 | |
185 | + | let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW)) | |
186 | + | let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs) | |
187 | + | let priceDiff = abs((priceBefore - marketPrice)) | |
188 | + | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
189 | + | let maxPriceImpactValue = maxPriceImpact() | |
190 | + | if ((priceImpact > maxPriceImpactValue)) | |
191 | + | then throw(((((((((((((("Price impact " + toString(priceImpact)) + " > max price impact ") + toString(maxPriceImpactValue)) + " before quote asset: ") + toString(_qtAstR)) + " before base asset: ") + toString(_bsAstR)) + " quote asset amount to exchange: ") + toString(_quoteAssetAmount)) + " price before: ") + toString(priceBefore)) + " marketPrice: ") + toString(marketPrice))) | |
192 | + | else $Tuple4(amountBaseAssetBought, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1) | |
193 | + | } | |
194 | + | ||
195 | + | ||
196 | + | func swapOutputWithReserves (_isAdd,_baseAssetAmount,_checkMaxPriceImpact,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = { | |
197 | + | let priceBefore = divd(muld(_quoteAssetReserve, _quoteAssetWeight), muld(_baseAssetReserve, _baseAssetWeight)) | |
198 | + | if ((_baseAssetAmount == 0)) | |
199 | + | then throw("Invalid base asset amount") | |
200 | + | else { | |
201 | + | let k = calcInvariant(_quoteAssetReserve, _baseAssetReserve) | |
202 | + | let baseAssetPoolAmountAfter = if (_isAdd) | |
203 | + | then (_baseAssetReserve + _baseAssetAmount) | |
204 | + | else (_baseAssetReserve - _baseAssetAmount) | |
205 | + | let quoteAssetAfter = toInt(bdivd(k, toBigInt(baseAssetPoolAmountAfter))) | |
206 | + | let quoteAssetDelta = abs((quoteAssetAfter - _quoteAssetReserve)) | |
207 | + | let quoteAssetSold = muld(quoteAssetDelta, _quoteAssetWeight) | |
208 | + | let maxPriceImpactValue = maxPriceImpact() | |
209 | + | let $t086918853 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount) | |
210 | + | let quoteAssetReserveAfter1 = $t086918853._1 | |
211 | + | let baseAssetReserveAfter1 = $t086918853._2 | |
212 | + | let totalPositionSizeAfter1 = $t086918853._3 | |
213 | + | let marketPrice = divd(quoteAssetSold, _baseAssetAmount) | |
214 | + | let priceDiff = abs((priceBefore - marketPrice)) | |
215 | + | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
216 | + | if (if ((priceImpact > maxPriceImpactValue)) | |
217 | + | then _checkMaxPriceImpact | |
218 | + | else false) | |
219 | + | then throw(((((((((((((("Price impact " + toString(priceImpact)) + " > max price impact ") + toString(maxPriceImpactValue)) + " before quote asset: ") + toString(_quoteAssetReserve)) + " before base asset: ") + toString(_baseAssetReserve)) + " base asset amount to exchange: ") + toString(_baseAssetAmount)) + " price before: ") + toString(priceBefore)) + " market price: ") + toString(marketPrice))) | |
220 | + | else $Tuple5(quoteAssetSold, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, priceImpact) | |
221 | + | } | |
222 | + | } | |
223 | + | ||
224 | + | ||
225 | + | func swapOutput (_isAdd,_baseAssetAmount,_checkMaxPriceImpact) = swapOutputWithReserves(_isAdd, _baseAssetAmount, _checkMaxPriceImpact, qtAstR(), qtAstW(), bsAstR(), bsAstW()) | |
226 | + | ||
227 | + | ||
228 | + | func getOraclePriceValue (oracle,priceKey,blockKey) = { | |
229 | + | let lastValue = valueOrErrorMessage(getInteger(oracle, priceKey), ((("Can not get oracle price. Oracle: " + toString(oracle)) + " key: ") + priceKey)) | |
230 | + | if ((blockKey != "")) | |
231 | + | then { | |
232 | + | let currentBlock = lastBlock.height | |
233 | + | let lastOracleBlock = valueOrErrorMessage(getInteger(oracle, blockKey), ((("Can not get oracle block. Oracle: " + toString(oracle)) + " key: ") + blockKey)) | |
234 | + | if (((currentBlock - lastOracleBlock) > maxOracleDelay())) | |
235 | + | then throw(((("Oracle stale data. Last oracle block: " + toString(lastOracleBlock)) + " current block: ") + toString(currentBlock))) | |
236 | + | else lastValue | |
237 | + | } | |
238 | + | else lastValue | |
239 | + | } | |
240 | + | ||
241 | + | ||
242 | + | func getOraclePrice () = { | |
243 | + | let baseOracle = valueOrErrorMessage(getOracleData(k_baseOracle), "No base asset oracle data") | |
244 | + | let baseOraclePrice = getOraclePriceValue(baseOracle._1, baseOracle._2, baseOracle._3) | |
245 | + | let quoteOraclePrice = DECIMAL_UNIT | |
246 | + | divd(baseOraclePrice, quoteOraclePrice) | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | func getSpotPrice () = { | |
251 | + | let _quoteAssetReserve = qtAstR() | |
252 | + | let _baseAssetReserve = bsAstR() | |
253 | + | let _qtAstW = qtAstW() | |
254 | + | let _bsAstW = bsAstW() | |
255 | + | divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW)) | |
256 | + | } | |
257 | + | ||
258 | + | ||
259 | + | func getTerminalAmmState () = { | |
260 | + | let _positionSize = totalPositionSize() | |
261 | + | if ((_positionSize == 0)) | |
262 | + | then $Tuple2(qtAstR(), bsAstR()) | |
263 | + | else { | |
264 | + | let direction = (_positionSize > 0) | |
265 | + | let $t01180111980 = swapOutput(direction, abs(_positionSize), false) | |
266 | + | let currentNetMarketValue = $t01180111980._1 | |
267 | + | let terminalQuoteAssetReserve = $t01180111980._2 | |
268 | + | let terminalBaseAssetReserve = $t01180111980._3 | |
269 | + | $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve) | |
270 | + | } | |
271 | + | } | |
272 | + | ||
273 | + | ||
274 | + | func getQuoteAssetWeight (baseAssetReserve,totalPositionSize,quoteAssetReserve,targetPrice) = { | |
275 | + | let b = toBigInt(baseAssetReserve) | |
276 | + | let sz = toBigInt(totalPositionSize) | |
277 | + | let q = toBigInt(quoteAssetReserve) | |
278 | + | let p = toBigInt(targetPrice) | |
279 | + | let k = bmuld(q, b) | |
280 | + | let newB = (b + sz) | |
281 | + | let newQ = bdivd(k, newB) | |
282 | + | let z = bdivd(newQ, newB) | |
283 | + | let result = bdivd(p, z) | |
284 | + | toInt(result) | |
285 | + | } | |
286 | + | ||
287 | + | ||
288 | + | func getSyncTerminalPrice (_terminalPrice,_qtAstR,_bsAstR) = { | |
289 | + | let _positionSize = totalPositionSize() | |
290 | + | if ((_positionSize == 0)) | |
291 | + | then { | |
292 | + | let newQtAstW = divd(muld(_terminalPrice, _bsAstR), _qtAstR) | |
293 | + | $Tuple2(newQtAstW, DECIMAL_UNIT) | |
294 | + | } | |
295 | + | else { | |
296 | + | let newQtAstW = getQuoteAssetWeight(_bsAstR, _positionSize, _qtAstR, _terminalPrice) | |
297 | + | let newBsAstW = DECIMAL_UNIT | |
298 | + | $Tuple2(newQtAstW, newBsAstW) | |
299 | + | } | |
300 | + | } | |
301 | + | ||
302 | + | ||
303 | + | func updateSettings (_maxPriceImpact,_maxPriceSpread,_maxOracleDelay) = [IntegerEntry(k_maxPriceImpact, _maxPriceImpact), IntegerEntry(k_maxPriceSpread, _maxPriceSpread), IntegerEntry(k_maxOracleDelay, _maxOracleDelay)] | |
304 | + | ||
305 | + | ||
306 | + | func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)] | |
307 | + | ||
308 | + | ||
309 | + | func updateAmmWeights (_qtAstW,_bsAstW) = [IntegerEntry(k_quoteAssetWeight, _qtAstW), IntegerEntry(k_baseAssetWeight, _bsAstW)] | |
310 | + | ||
311 | + | ||
312 | + | func updateAmm (_qtAstR,_bsAstR,_totalPositionSizeAfter) = { | |
313 | + | let _qtAstW = qtAstW() | |
314 | + | let _bsAstW = bsAstW() | |
315 | + | (updateAmmReserves(_qtAstR, _bsAstR) ++ [IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter)]) | |
316 | + | } | |
317 | + | ||
318 | + | ||
319 | + | @Callable(i) | |
320 | + | func pause () = if ((i.caller != adminAddress())) | |
321 | + | then throw("Invalid pause params") | |
322 | + | else [BooleanEntry(k_paused, true)] | |
323 | + | ||
324 | + | ||
325 | + | ||
326 | + | @Callable(i) | |
327 | + | func unpause () = if ((i.caller != adminAddress())) | |
328 | + | then throw("Invalid unpause params") | |
329 | + | else [BooleanEntry(k_paused, false)] | |
330 | + | ||
331 | + | ||
332 | + | ||
333 | + | @Callable(i) | |
334 | + | func changeLiquidity (_quoteAssetAmount) = if (!(if ((i.caller == spotAddress())) | |
335 | + | then true | |
336 | + | else (i.caller == adminAddress()))) | |
337 | + | then throw("Invalid changeLiquidity params") | |
338 | + | else { | |
339 | + | let _qtAstR = qtAstR() | |
340 | + | let _bsAstR = bsAstR() | |
341 | + | let _qtAstW = qtAstW() | |
342 | + | let _bsAstW = bsAstW() | |
343 | + | let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW)) | |
344 | + | let qtAstRAfter = (_qtAstR + _quoteAssetAmount) | |
345 | + | let baseAssetAmountToAdd = (divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR) | |
346 | + | let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd) | |
347 | + | let $t01523615366 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter) | |
348 | + | let newQuoteAssetWeight = $t01523615366._1 | |
349 | + | let newBaseAssetWeight = $t01523615366._2 | |
350 | + | (updateAmmReserves(qtAstRAfter, bsAstRAfter) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)) | |
351 | + | } | |
352 | + | ||
353 | + | ||
354 | + | ||
355 | + | @Callable(i) | |
356 | + | func changeSettings (_maxPriceImpact,_maxPriceSpread,_maxOracleDelay) = if (if (if (if (if ((0 >= _maxPriceImpact)) | |
357 | + | then true | |
358 | + | else (0 >= _maxPriceSpread)) | |
359 | + | then true | |
360 | + | else (0 >= _maxOracleDelay)) | |
361 | + | then true | |
362 | + | else !(initialized())) | |
363 | + | then true | |
364 | + | else (i.caller != adminAddress())) | |
365 | + | then throw("Invalid changeSettings params") | |
366 | + | else updateSettings(_maxPriceImpact, _maxPriceSpread, _maxOracleDelay) | |
367 | + | ||
368 | + | ||
369 | + | ||
370 | + | @Callable(i) | |
371 | + | func initialize (_qtAstR,_bsAstR,_baseOracleData,_coordinator,_maxPriceImpact,_maxPriceSpread,_maxOracleDelay) = if (if (if (if (if (if (if ((0 >= _qtAstR)) | |
372 | + | then true | |
373 | + | else (0 >= _bsAstR)) | |
374 | + | then true | |
375 | + | else (0 >= _maxPriceImpact)) | |
376 | + | then true | |
377 | + | else (0 >= _maxPriceSpread)) | |
378 | + | then true | |
379 | + | else (0 >= _maxOracleDelay)) | |
380 | + | then true | |
381 | + | else initialized()) | |
382 | + | then true | |
383 | + | else (i.caller != this)) | |
384 | + | then throw("Invalid initialize parameters") | |
385 | + | else ((updateAmm(_qtAstR, _bsAstR, 0) ++ updateSettings(_maxPriceImpact, _maxPriceSpread, _maxOracleDelay)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_baseOracle, _baseOracleData), StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator)))]) | |
386 | + | ||
387 | + | ||
388 | + | ||
389 | + | @Callable(i) | |
390 | + | func swapToBase (_amount,_minBaseAssetAmount) = { | |
391 | + | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
392 | + | if ((sync == sync)) | |
393 | + | then { | |
394 | + | let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil) | |
395 | + | if ((ensureCalledOnce == ensureCalledOnce)) | |
396 | + | then if (if (if (!(initialized())) | |
397 | + | then true | |
398 | + | else paused()) | |
399 | + | then true | |
400 | + | else (i.caller != spotAddress())) | |
401 | + | then throw("Invalid swapToBase parameters") | |
402 | + | else { | |
403 | + | let $t01791318070 = swapInput(true, _amount) | |
404 | + | let amountBaseAssetBought = $t01791318070._1 | |
405 | + | let quoteAssetReserveAfter = $t01791318070._2 | |
406 | + | let baseAssetReserveAfter = $t01791318070._3 | |
407 | + | let totalPositionSizeAfter = $t01791318070._4 | |
408 | + | let update = updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter) | |
409 | + | $Tuple2(update, amountBaseAssetBought) | |
410 | + | } | |
411 | + | else throw("Strict value is not equal to itself.") | |
412 | + | } | |
413 | + | else throw("Strict value is not equal to itself.") | |
414 | + | } | |
415 | + | ||
416 | + | ||
417 | + | ||
418 | + | @Callable(i) | |
419 | + | func swapToQuote (_amount,_minQuoteAssetAmount) = { | |
420 | + | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
421 | + | if ((sync == sync)) | |
422 | + | then { | |
423 | + | let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil) | |
424 | + | if ((ensureCalledOnce == ensureCalledOnce)) | |
425 | + | then if (if (if (!(initialized())) | |
426 | + | then true | |
427 | + | else paused()) | |
428 | + | then true | |
429 | + | else (i.caller != spotAddress())) | |
430 | + | then throw("Invalid swapToQuote parameters") | |
431 | + | else { | |
432 | + | let $t01861518773 = swapOutput(true, _amount, true) | |
433 | + | let amountQuoteAssetBought = $t01861518773._1 | |
434 | + | let quoteAssetReserveAfter = $t01861518773._2 | |
435 | + | let baseAssetReserveAfter = $t01861518773._3 | |
436 | + | let totalPositionSizeAfter = (totalPositionSize() - _amount) | |
437 | + | let update = updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter) | |
438 | + | $Tuple2(update, amountQuoteAssetBought) | |
439 | + | } | |
440 | + | else throw("Strict value is not equal to itself.") | |
441 | + | } | |
442 | + | else throw("Strict value is not equal to itself.") | |
443 | + | } | |
444 | + | ||
445 | + | ||
446 | + | ||
447 | + | @Callable(i) | |
448 | + | func syncTerminalPriceToOracle () = { | |
449 | + | let _qtAstR = qtAstR() | |
450 | + | let _bsAstR = bsAstR() | |
451 | + | let $t01941919535 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR) | |
452 | + | let newQuoteAssetWeight = $t01941919535._1 | |
453 | + | let newBaseAssetWeight = $t01941919535._2 | |
454 | + | updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight) | |
455 | + | } | |
456 | + | ||
457 | + | ||
458 | + | ||
459 | + | @Callable(i) | |
460 | + | func ensureCalledOnce () = if ((i.caller != this)) | |
461 | + | then throw("Invalid saveCurrentTxId parameters") | |
462 | + | else { | |
463 | + | let txId = toBase58String(i.transactionId) | |
464 | + | let lastTx = valueOrElse(getString(this, k_lastTx), "") | |
465 | + | if ((lastTx != txId)) | |
466 | + | then [StringEntry(k_lastTx, txId)] | |
467 | + | else throw("Can not call vAMM methods twice in one tx") | |
468 | + | } | |
469 | + | ||
470 | + | ||
471 | + | ||
472 | + | @Callable(i) | |
473 | + | func view_getTerminalAmmPrice () = { | |
474 | + | let $t02028920370 = getTerminalAmmState() | |
475 | + | let terminalQuoteAssetReserve = $t02028920370._1 | |
476 | + | let terminalBaseAssetReserve = $t02028920370._2 | |
477 | + | let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW())) | |
478 | + | throw(toString(price)) | |
479 | + | } | |
480 | + | ||
481 | + | ||
482 | + | ||
483 | + | @Callable(i) | |
484 | + | func computeSpotPrice () = { | |
485 | + | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
486 | + | if ((sync == sync)) | |
487 | + | then { | |
488 | + | let result = getSpotPrice() | |
489 | + | $Tuple2(nil, result) | |
490 | + | } | |
491 | + | else throw("Strict value is not equal to itself.") | |
492 | + | } | |
493 | + | ||
494 | + | ||
495 | + | ||
496 | + | @Callable(i) | |
497 | + | func computeTerminalAmmPrice () = { | |
498 | + | let $t02104321124 = getTerminalAmmState() | |
499 | + | let terminalQuoteAssetReserve = $t02104321124._1 | |
500 | + | let terminalBaseAssetReserve = $t02104321124._2 | |
501 | + | let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW())) | |
502 | + | $Tuple2(nil, price) | |
503 | + | } | |
504 | + | ||
505 | + | ||
506 | + | @Verifier(tx) | |
507 | + | func verify () = { | |
508 | + | let coordinatorStr = getString(this, k_coordinatorAddress) | |
509 | + | if (isDefined(coordinatorStr)) | |
510 | + | then { | |
511 | + | let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address) | |
512 | + | if (isDefined(admin)) | |
513 | + | then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
514 | + | else throw("unable to verify: admin not set in coordinator") | |
515 | + | } | |
516 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
517 | + | } | |
518 | + |
github/deemru/w8io/169f3d6 30.16 ms ◑