tx · 9tUhaUtJn6YF5TVg6bMYz6cEn1E4z8jNScYoDaaHYMTE 3Mtzn1SRUhygEXMVpHNMckc8HKCWjq2fTiG: -0.01400000 Waves 2020.08.03 15:51 [1116197] smart account 3Mtzn1SRUhygEXMVpHNMckc8HKCWjq2fTiG > SELF 0.00000000 Waves
{ "type": 13, "id": "9tUhaUtJn6YF5TVg6bMYz6cEn1E4z8jNScYoDaaHYMTE", "fee": 1400000, "feeAssetId": null, "timestamp": 1596459185120, "version": 1, "sender": "3Mtzn1SRUhygEXMVpHNMckc8HKCWjq2fTiG", "senderPublicKey": "2WHjsmTCwLeerJuc5YMaJNou8UGSHuy4TE3F6DneRaJt", "proofs": [ "56EciJuM5soyBGp4aeVdMebBc3T4BSQmXieKEAt2q7Pn2a8gSiK171njZFAKddC52drLGGfmMEF5wDdgeTWfBzLc" ], "script": "base64:AAIDAAAAAAAAACIIARIHCgUICAgICBIHCgUBAQEBBBIDCgEIEgASAwoBCBIAAAAAMgAAAAAHQlVMTEtleQIAAAAGQlVMTElkAAAAAAdCRUFSS2V5AgAAAAZCRUFSSWQAAAAADG1haW5Ub2tlbktleQIAAAALbWFpblRva2VuSWQAAAAAEmlzc3VlUGVyY2VudGlsZUtleQIAAAAPaXNzdWVQZXJjZW50aWxlAAAAABNyZWRlZW1QZXJjZW50aWxlS2V5AgAAABByZWRlZW1QZXJjZW50aWxlAAAAAAttaW5Jc3N1ZUtleQIAAAAIbWluSXNzdWUAAAAADG1pblJlZGVlbUtleQIAAAAJbWluUmVkZWVtAAAAABB3aGl0ZWxpc3RPbmx5S2V5AgAAAA13aGl0ZWxpc3RPbmx5AAAAAAtvcmFjbGVQS0tleQIAAAAGb3JhY2xlAAAAABFsYXN0UHJpY2VJbmRleEtleQIAAAALcHJpY2VfaW5kZXgAAAAAEHByaWNlSW5kZXhQcmVmaXgCAAAADHByaWNlX2luZGV4XwAAAAARcHJpY2VIZWlnaHRQcmVmaXgCAAAABnByaWNlXwAAAAAab3JhY2xlQ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IG5lZWQgdG8gd2FpdAMJAAAAAAAAAgUAAAAKcHJpY2VJbmRleAUAAAAUcmViYWxhbmNlZFByaWNlSW5kZXgJAQAAAAdkZXF1ZXVlAAAAAAkAAAIAAAABAgAAADBjb3JydXB0IGRhdGEsIGZ1dHVyZSBwcmljZSBpZCBhbHJlYWR5IHJlYmFsYW5jZWQAAAAAdLu9Qw==", "chainId": 84, "height": 1116197, "spentComplexity": 0 } View: original | compacted Prev: 7WEFUJug9eGL7X9P5obhaTq9Kfc8UPSzTG8A9DiUJZDN Next: 6r9GJCVKHSTieZPQzysTH4SncsbqC2CzRCMZdy85Lqxz Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | ||
20 | 20 | let oraclePKKey = "oracle" | |
21 | 21 | ||
22 | - | let | |
22 | + | let lastPriceIndexKey = "price_index" | |
23 | 23 | ||
24 | - | let lastRebalancePriceIdKey = "lastSettlementPriceId" | |
24 | + | let priceIndexPrefix = "price_index_" | |
25 | + | ||
26 | + | let priceHeightPrefix = "price_" | |
27 | + | ||
28 | + | let oracleCurrentPriceIndexKey = "price_index" | |
29 | + | ||
30 | + | let lastRebalancePriceIndexKey = "lastSettlementPriceId" | |
25 | 31 | ||
26 | 32 | let bullCollateralKey = "bullCollateral" | |
27 | 33 | ||
61 | 67 | ||
62 | 68 | let oracle = valueOrErrorMessage(addressFromPublicKey(fromBase58String(valueOrErrorMessage(getString(this, oraclePKKey), "no oraclePKKey"))), "bad oracle address") | |
63 | 69 | ||
64 | - | let | |
70 | + | let rebalancedPriceIndex = valueOrErrorMessage(getInteger(this, lastRebalancePriceIndexKey), "no last rebalance price") | |
65 | 71 | ||
66 | - | let | |
72 | + | let oraclePriceIndex = valueOrErrorMessage(getInteger(oracle, oracleCurrentPriceIndexKey), "bad oracle data") | |
67 | 73 | ||
68 | 74 | let headPointerKey = "headPointer" | |
69 | 75 | ||
105 | 111 | ||
106 | 112 | let REDEEM = "REDEEM" | |
107 | 113 | ||
108 | - | func buildNewItem (action,amt,token, | |
114 | + | func buildNewItem (action,amt,token,priceIndex,invoker) = (((((((((action + "|") + toString(amt)) + "|") + token) + "|") + toString(priceIndex)) + "|") + invoker) + "|") | |
109 | 115 | ||
110 | 116 | ||
111 | 117 | func validateEnqueue (inv) = if ((inv.caller == this)) | |
137 | 143 | } | |
138 | 144 | ||
139 | 145 | ||
140 | - | func enqueue (id,action,amt,token, | |
146 | + | func enqueue (id,action,amt,token,priceIndex,invoker) = { | |
141 | 147 | let increaseQueueSize = DataEntry(queueSizeKey, (queueSize + 1)) | |
142 | - | let itm = buildNewItem(action, amt, token, | |
148 | + | let itm = buildNewItem(action, amt, token, priceIndex, invoker) | |
143 | 149 | if ((queueSize == 0)) | |
144 | 150 | then WriteSet([DataEntry(headPointerKey, id), DataEntry(tailPointerKey, id), DataEntry(id, itm), increaseQueueSize]) | |
145 | 151 | else { | |
163 | 169 | let action = data[0] | |
164 | 170 | let amt = parseIntValue(data[1]) | |
165 | 171 | let token = data[2] | |
166 | - | let | |
172 | + | let priceIndex = parseIntValue(data[3]) | |
167 | 173 | let invoker = addressFromStringValue(data[4]) | |
168 | 174 | let next = data[5] | |
169 | - | if (( | |
170 | - | then throw(((("corrupt state, | |
171 | - | else if (( | |
175 | + | if ((rebalancedPriceIndex > priceIndex)) | |
176 | + | then throw(((("corrupt state, rebalancedPriceIndex=" + toString(rebalancedPriceIndex)) + ", request price id=") + toString(priceIndex))) | |
177 | + | else if ((priceIndex > rebalancedPriceIndex)) | |
172 | 178 | then throw("can't dequeue, too early, rebalance first") | |
173 | 179 | else if ((action == ISSUE)) | |
174 | 180 | then { | |
239 | 245 | fraction(v, ((6 * a) + b), ((7 * a) + b)) | |
240 | 246 | } | |
241 | 247 | ||
242 | - | let settledPriceId = valueOrErrorMessage(getInteger(this, lastRebalancePriceIdKey), "inconsistent data") | |
243 | - | let unsettledPriceId = (settledPriceId + 1) | |
244 | - | let settledPrice = valueOrErrorMessage(getInteger(oracle, toString(settledPriceId)), "bad oracle data for sellted price") | |
245 | - | let nextPrice = valueOrErrorMessage(getInteger(oracle, toString(unsettledPriceId)), "no next price") | |
248 | + | let settledPriceIndex = valueOrErrorMessage(getInteger(this, lastRebalancePriceIndexKey), "inconsistent data") | |
249 | + | let unsettledPriceIndex = (settledPriceIndex + 1) | |
250 | + | let settledPriceHeight = valueOrErrorMessage(getInteger(oracle, ("price_index_" + toString(settledPriceIndex))), "bad oracle data for settled price height") | |
251 | + | let settledPrice = valueOrErrorMessage(getInteger(oracle, ("price_" + toString(settledPriceHeight))), "bad oracle data for price") | |
252 | + | let nextPriceHeight = valueOrErrorMessage(getInteger(oracle, ("price_index_" + toString(unsettledPriceIndex))), "no next price height") | |
253 | + | let nextPrice = valueOrErrorMessage(getInteger(oracle, ("price_" + toString(nextPriceHeight))), "no next price") | |
246 | 254 | let minVol = if ((bearCol > bullCol)) | |
247 | 255 | then bullCol | |
248 | 256 | else bearCol | |
249 | 257 | let redist = LV(minVol, settledPrice, nextPrice) | |
250 | 258 | if ((nextPrice > settledPrice)) | |
251 | - | then WriteSet([DataEntry(bullCollateralKey, (bullCol + redist)), DataEntry(bearCollateralKey, (bearCol - redist)), DataEntry( | |
259 | + | then WriteSet([DataEntry(bullCollateralKey, (bullCol + redist)), DataEntry(bearCollateralKey, (bearCol - redist)), DataEntry(lastRebalancePriceIndexKey, unsettledPriceIndex)]) | |
252 | 260 | else if ((settledPrice > nextPrice)) | |
253 | - | then WriteSet([DataEntry(bullCollateralKey, (bullCol - redist)), DataEntry(bearCollateralKey, (bearCol + redist)), DataEntry( | |
254 | - | else WriteSet([DataEntry( | |
261 | + | then WriteSet([DataEntry(bullCollateralKey, (bullCol - redist)), DataEntry(bearCollateralKey, (bearCol + redist)), DataEntry(lastRebalancePriceIndexKey, unsettledPriceIndex)]) | |
262 | + | else WriteSet([DataEntry(lastRebalancePriceIndexKey, unsettledPriceIndex)]) | |
255 | 263 | } | |
256 | 264 | ||
257 | 265 | ||
271 | 279 | else (bulls == 0)) | |
272 | 280 | then throw("can't init balances") | |
273 | 281 | else { | |
274 | - | let | |
275 | - | ScriptResult(WriteSet([DataEntry(BULLKey, bullId), DataEntry(BEARKey, bearId), DataEntry(mainTokenKey, mainTokenId), DataEntry(oraclePKKey, oraclePK), DataEntry(bullCollateralKey, bulls), DataEntry(bearCollateralKey, bears), DataEntry(bullCirculationKey, bulls), DataEntry(bearCirculationKey, bears), DataEntry( | |
282 | + | let oracleCurrentPriceIndex = valueOrErrorMessage(getInteger(valueOrErrorMessage(addressFromPublicKey(fromBase58String(oraclePK)), "bad oracle address"), oracleCurrentPriceIndexKey), "can't find oracle price id") | |
283 | + | ScriptResult(WriteSet([DataEntry(BULLKey, bullId), DataEntry(BEARKey, bearId), DataEntry(mainTokenKey, mainTokenId), DataEntry(oraclePKKey, oraclePK), DataEntry(bullCollateralKey, bulls), DataEntry(bearCollateralKey, bears), DataEntry(bullCirculationKey, bulls), DataEntry(bearCirculationKey, bears), DataEntry(lastRebalancePriceIndexKey, oracleCurrentPriceIndex), DataEntry(whitelistKey, whitelisted), DataEntry(issuePercentileKey, 0), DataEntry(redeemPercentileKey, 0), DataEntry(minIssueKey, 0), DataEntry(minRedeemKey, 0), DataEntry(whitelistOnlyKey, true)]), TransferSet([ScriptTransfer(inv.caller, bulls, fromBase58String(bullId)), ScriptTransfer(inv.caller, bears, fromBase58String(bearId))])) | |
276 | 284 | } | |
277 | 285 | } | |
278 | 286 | ||
296 | 304 | func requestRedeem () = if ((validateEnqueue(inv) == unit)) | |
297 | 305 | then { | |
298 | 306 | let assetId = toBase58String(valueOrErrorMessage(value(inv.payment).assetId, "waves are not accepted here")) | |
299 | - | enqueue(toBase58String(inv.transactionId), REDEEM, value(inv.payment).amount, assetId, ( | |
307 | + | enqueue(toBase58String(inv.transactionId), REDEEM, value(inv.payment).amount, assetId, (oraclePriceIndex + 1), toString(inv.caller)) | |
300 | 308 | } | |
301 | 309 | else throw("doesn't happen") | |
302 | 310 | ||
321 | 329 | then errorMessage | |
322 | 330 | else if ((minIssue > value(inv.payment).amount)) | |
323 | 331 | then throw((("Attached payment too small. Min required: " + toString((minIssue / 1000000))) + " USDN")) | |
324 | - | else enqueue(toBase58String(inv.transactionId), ISSUE, value(inv.payment).amount, tokenId, ( | |
332 | + | else enqueue(toBase58String(inv.transactionId), ISSUE, value(inv.payment).amount, tokenId, (oraclePriceIndex + 1), toString(inv.caller)) | |
325 | 333 | } | |
326 | 334 | ||
327 | 335 | ||
329 | 337 | @Callable(inv) | |
330 | 338 | func settle () = { | |
331 | 339 | let queueEmpty = (headPointer == "") | |
332 | - | let canRebalance = ( | |
340 | + | let canRebalance = (oraclePriceIndex > rebalancedPriceIndex) | |
333 | 341 | if (queueEmpty) | |
334 | 342 | then if (canRebalance) | |
335 | 343 | then rebalance() | |
336 | 344 | else throw("[OK] all done, carry on") | |
337 | 345 | else { | |
338 | 346 | let data = split(valueOrErrorMessage(getString(this, headPointer), "bad head pointer"), "|") | |
339 | - | let | |
340 | - | if (( | |
347 | + | let priceIndex = parseIntValue(data[3]) | |
348 | + | if ((priceIndex > rebalancedPriceIndex)) | |
341 | 349 | then if (canRebalance) | |
342 | 350 | then rebalance() | |
343 | 351 | else throw("[OK] need to wait") | |
344 | - | else if (( | |
352 | + | else if ((priceIndex == rebalancedPriceIndex)) | |
345 | 353 | then dequeue() | |
346 | 354 | else throw("corrupt data, future price id already rebalanced") | |
347 | 355 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BULLKey = "BULLId" | |
5 | 5 | ||
6 | 6 | let BEARKey = "BEARId" | |
7 | 7 | ||
8 | 8 | let mainTokenKey = "mainTokenId" | |
9 | 9 | ||
10 | 10 | let issuePercentileKey = "issuePercentile" | |
11 | 11 | ||
12 | 12 | let redeemPercentileKey = "redeemPercentile" | |
13 | 13 | ||
14 | 14 | let minIssueKey = "minIssue" | |
15 | 15 | ||
16 | 16 | let minRedeemKey = "minRedeem" | |
17 | 17 | ||
18 | 18 | let whitelistOnlyKey = "whitelistOnly" | |
19 | 19 | ||
20 | 20 | let oraclePKKey = "oracle" | |
21 | 21 | ||
22 | - | let | |
22 | + | let lastPriceIndexKey = "price_index" | |
23 | 23 | ||
24 | - | let lastRebalancePriceIdKey = "lastSettlementPriceId" | |
24 | + | let priceIndexPrefix = "price_index_" | |
25 | + | ||
26 | + | let priceHeightPrefix = "price_" | |
27 | + | ||
28 | + | let oracleCurrentPriceIndexKey = "price_index" | |
29 | + | ||
30 | + | let lastRebalancePriceIndexKey = "lastSettlementPriceId" | |
25 | 31 | ||
26 | 32 | let bullCollateralKey = "bullCollateral" | |
27 | 33 | ||
28 | 34 | let bearCollateralKey = "bearCollateral" | |
29 | 35 | ||
30 | 36 | let bullCirculationKey = "bullCirculation" | |
31 | 37 | ||
32 | 38 | let bearCirculationKey = "bearCirculation" | |
33 | 39 | ||
34 | 40 | let whitelistKey = "issueWhiteList" | |
35 | 41 | ||
36 | 42 | let whitelist = valueOrErrorMessage(getString(this, whitelistKey), "no bullCollateralKey") | |
37 | 43 | ||
38 | 44 | let bullCol = valueOrErrorMessage(getInteger(this, bullCollateralKey), "no bullCollateralKey") | |
39 | 45 | ||
40 | 46 | let bearCol = valueOrErrorMessage(getInteger(this, bearCollateralKey), "no bearCollateralKey") | |
41 | 47 | ||
42 | 48 | let bullCirc = valueOrErrorMessage(getInteger(this, bullCirculationKey), "no bullCirculationKey") | |
43 | 49 | ||
44 | 50 | let bearCirc = valueOrErrorMessage(getInteger(this, bearCirculationKey), "no bearCirculationKey") | |
45 | 51 | ||
46 | 52 | let BULL = valueOrErrorMessage(getString(this, BULLKey), "no BULLKey") | |
47 | 53 | ||
48 | 54 | let BEAR = valueOrErrorMessage(getString(this, BEARKey), "no BEARKey") | |
49 | 55 | ||
50 | 56 | let mainToken = valueOrErrorMessage(getString(this, mainTokenKey), "no mainTokenKey") | |
51 | 57 | ||
52 | 58 | let issuePercentile = valueOrErrorMessage(getInteger(this, issuePercentileKey), "no issuePercentileKey") | |
53 | 59 | ||
54 | 60 | let redeemPercentile = valueOrErrorMessage(getInteger(this, redeemPercentileKey), "no redeemPercentileKey") | |
55 | 61 | ||
56 | 62 | let minIssue = valueOrErrorMessage(getInteger(this, minIssueKey), "no minIssueKey") | |
57 | 63 | ||
58 | 64 | let minRedeem = valueOrErrorMessage(getInteger(this, minRedeemKey), "no minRedeemKey") | |
59 | 65 | ||
60 | 66 | let whitelistOnly = valueOrErrorMessage(getBoolean(this, whitelistOnlyKey), "no whitelistOnlyKey") | |
61 | 67 | ||
62 | 68 | let oracle = valueOrErrorMessage(addressFromPublicKey(fromBase58String(valueOrErrorMessage(getString(this, oraclePKKey), "no oraclePKKey"))), "bad oracle address") | |
63 | 69 | ||
64 | - | let | |
70 | + | let rebalancedPriceIndex = valueOrErrorMessage(getInteger(this, lastRebalancePriceIndexKey), "no last rebalance price") | |
65 | 71 | ||
66 | - | let | |
72 | + | let oraclePriceIndex = valueOrErrorMessage(getInteger(oracle, oracleCurrentPriceIndexKey), "bad oracle data") | |
67 | 73 | ||
68 | 74 | let headPointerKey = "headPointer" | |
69 | 75 | ||
70 | 76 | let tailPointerKey = "tailPointer" | |
71 | 77 | ||
72 | 78 | let queueSizeKey = "queueSize" | |
73 | 79 | ||
74 | 80 | let queueSize = match getInteger(this, queueSizeKey) { | |
75 | 81 | case i: Int => | |
76 | 82 | i | |
77 | 83 | case _ => | |
78 | 84 | 0 | |
79 | 85 | } | |
80 | 86 | ||
81 | 87 | let headPointer = match getString(this, headPointerKey) { | |
82 | 88 | case s: String => | |
83 | 89 | s | |
84 | 90 | case _ => | |
85 | 91 | "" | |
86 | 92 | } | |
87 | 93 | ||
88 | 94 | let tailPointer = match getString(this, tailPointerKey) { | |
89 | 95 | case s: String => | |
90 | 96 | s | |
91 | 97 | case _ => | |
92 | 98 | "" | |
93 | 99 | } | |
94 | 100 | ||
95 | 101 | let feesAccumulatedKey = "feesAccumulated" | |
96 | 102 | ||
97 | 103 | let feesAccumulated = match getInteger(this, feesAccumulatedKey) { | |
98 | 104 | case i: Int => | |
99 | 105 | i | |
100 | 106 | case _ => | |
101 | 107 | 0 | |
102 | 108 | } | |
103 | 109 | ||
104 | 110 | let ISSUE = "ISSUE" | |
105 | 111 | ||
106 | 112 | let REDEEM = "REDEEM" | |
107 | 113 | ||
108 | - | func buildNewItem (action,amt,token, | |
114 | + | func buildNewItem (action,amt,token,priceIndex,invoker) = (((((((((action + "|") + toString(amt)) + "|") + token) + "|") + toString(priceIndex)) + "|") + invoker) + "|") | |
109 | 115 | ||
110 | 116 | ||
111 | 117 | func validateEnqueue (inv) = if ((inv.caller == this)) | |
112 | 118 | then throw("can't do") | |
113 | 119 | else { | |
114 | 120 | func errorMessage (got) = throw(((((("only BULL(" + BULL) + ") or BEAR(") + BEAR) + ") tokens are accepted, received: ") + got)) | |
115 | 121 | ||
116 | 122 | if (!(isDefined(inv.payment))) | |
117 | 123 | then errorMessage("no attached payment") | |
118 | 124 | else { | |
119 | 125 | let assetId = toBase58String(valueOrErrorMessage(value(inv.payment).assetId, "waves are not accepted here")) | |
120 | 126 | if (if ((assetId != BEAR)) | |
121 | 127 | then (assetId != BULL) | |
122 | 128 | else false) | |
123 | 129 | then errorMessage(assetId) | |
124 | 130 | else { | |
125 | 131 | let col = if ((assetId == BEAR)) | |
126 | 132 | then bearCol | |
127 | 133 | else bullCol | |
128 | 134 | let circ = if ((assetId == BEAR)) | |
129 | 135 | then bearCirc | |
130 | 136 | else bearCirc | |
131 | 137 | let estimated = fraction(col, value(inv.payment).amount, circ) | |
132 | 138 | if ((minRedeem > estimated)) | |
133 | 139 | then throw((("Attached payment too small. Min redeem amount is " + toString((minRedeem / 1000000))) + " USDN")) | |
134 | 140 | else unit | |
135 | 141 | } | |
136 | 142 | } | |
137 | 143 | } | |
138 | 144 | ||
139 | 145 | ||
140 | - | func enqueue (id,action,amt,token, | |
146 | + | func enqueue (id,action,amt,token,priceIndex,invoker) = { | |
141 | 147 | let increaseQueueSize = DataEntry(queueSizeKey, (queueSize + 1)) | |
142 | - | let itm = buildNewItem(action, amt, token, | |
148 | + | let itm = buildNewItem(action, amt, token, priceIndex, invoker) | |
143 | 149 | if ((queueSize == 0)) | |
144 | 150 | then WriteSet([DataEntry(headPointerKey, id), DataEntry(tailPointerKey, id), DataEntry(id, itm), increaseQueueSize]) | |
145 | 151 | else { | |
146 | 152 | let prevId = valueOrErrorMessage(getString(this, tailPointerKey), "can't get tail pointer") | |
147 | 153 | let prevItm = split(valueOrErrorMessage(getString(this, prevId), "can't resolve pointer"), "|") | |
148 | 154 | let updatedPrevItm = ((((((((((prevItm[0] + "|") + prevItm[1]) + "|") + prevItm[2]) + "|") + prevItm[3]) + "|") + prevItm[4]) + "|") + id) | |
149 | 155 | WriteSet([DataEntry(prevId, updatedPrevItm), DataEntry(id, itm), DataEntry(tailPointerKey, id), increaseQueueSize]) | |
150 | 156 | } | |
151 | 157 | } | |
152 | 158 | ||
153 | 159 | ||
154 | 160 | func dequeue () = if ((queueSize == 0)) | |
155 | 161 | then throw("nothing to settle") | |
156 | 162 | else { | |
157 | 163 | func collectFee (fees) = DataEntry(feesAccumulatedKey, (feesAccumulated + fees)) | |
158 | 164 | ||
159 | 165 | let decreaseQueueSize = DataEntry(queueSizeKey, (queueSize - 1)) | |
160 | 166 | let isLastElement = (headPointer == tailPointer) | |
161 | 167 | let overwriteTail = DataEntry(tailPointerKey, "") | |
162 | 168 | let data = split(valueOrErrorMessage(getString(this, headPointer), "bad head pointer"), "|") | |
163 | 169 | let action = data[0] | |
164 | 170 | let amt = parseIntValue(data[1]) | |
165 | 171 | let token = data[2] | |
166 | - | let | |
172 | + | let priceIndex = parseIntValue(data[3]) | |
167 | 173 | let invoker = addressFromStringValue(data[4]) | |
168 | 174 | let next = data[5] | |
169 | - | if (( | |
170 | - | then throw(((("corrupt state, | |
171 | - | else if (( | |
175 | + | if ((rebalancedPriceIndex > priceIndex)) | |
176 | + | then throw(((("corrupt state, rebalancedPriceIndex=" + toString(rebalancedPriceIndex)) + ", request price id=") + toString(priceIndex))) | |
177 | + | else if ((priceIndex > rebalancedPriceIndex)) | |
172 | 178 | then throw("can't dequeue, too early, rebalance first") | |
173 | 179 | else if ((action == ISSUE)) | |
174 | 180 | then { | |
175 | 181 | let feeSize = fraction(amt, issuePercentile, 10000) | |
176 | 182 | let addedCollateral = (amt - feeSize) | |
177 | 183 | if ((token == BULL)) | |
178 | 184 | then { | |
179 | 185 | let addedToCirculation = fraction(bullCirc, addedCollateral, bullCol) | |
180 | 186 | let items = [DataEntry(bullCollateralKey, (bullCol + addedCollateral)), DataEntry(bullCirculationKey, (bullCirc + addedToCirculation)), DataEntry(headPointerKey, next), collectFee(feeSize), decreaseQueueSize] | |
181 | 187 | ScriptResult(WriteSet(if (isLastElement) | |
182 | 188 | then overwriteTail :: items | |
183 | 189 | else items), TransferSet([ScriptTransfer(invoker, addedToCirculation, fromBase58String(BULL))])) | |
184 | 190 | } | |
185 | 191 | else if ((token == BEAR)) | |
186 | 192 | then { | |
187 | 193 | let addedToCirculation = fraction(bearCirc, addedCollateral, bearCol) | |
188 | 194 | let items = [DataEntry(bearCollateralKey, (bearCol + addedCollateral)), DataEntry(bearCirculationKey, (bearCirc + addedToCirculation)), DataEntry(headPointerKey, next), collectFee(feeSize), decreaseQueueSize] | |
189 | 195 | ScriptResult(WriteSet(if (isLastElement) | |
190 | 196 | then overwriteTail :: items | |
191 | 197 | else items), TransferSet([ScriptTransfer(invoker, addedToCirculation, fromBase58String(BEAR))])) | |
192 | 198 | } | |
193 | 199 | else throw("bad token id") | |
194 | 200 | } | |
195 | 201 | else if ((action == REDEEM)) | |
196 | 202 | then { | |
197 | 203 | let removedTokens = amt | |
198 | 204 | if ((token == BULL)) | |
199 | 205 | then { | |
200 | 206 | let removedCollateral = fraction(bullCol, removedTokens, bullCirc) | |
201 | 207 | let feeSize = fraction(removedCollateral, redeemPercentile, 10000) | |
202 | 208 | let payout = if ((removedCollateral > feeSize)) | |
203 | 209 | then (removedCollateral - feeSize) | |
204 | 210 | else 0 | |
205 | 211 | let items = [DataEntry(bullCollateralKey, (bullCol - removedCollateral)), DataEntry(bullCirculationKey, (bullCirc - removedTokens)), DataEntry(headPointerKey, next), collectFee(feeSize), decreaseQueueSize] | |
206 | 212 | ScriptResult(WriteSet(if (isLastElement) | |
207 | 213 | then overwriteTail :: items | |
208 | 214 | else items), TransferSet([ScriptTransfer(invoker, payout, fromBase58String(mainToken))])) | |
209 | 215 | } | |
210 | 216 | else if ((token == BEAR)) | |
211 | 217 | then { | |
212 | 218 | let removedCollateral = fraction(bearCol, removedTokens, bearCirc) | |
213 | 219 | let feeSize = fraction(removedCollateral, redeemPercentile, 10000) | |
214 | 220 | let payout = if ((removedCollateral > feeSize)) | |
215 | 221 | then (removedCollateral - feeSize) | |
216 | 222 | else 0 | |
217 | 223 | let items = [DataEntry(bearCollateralKey, (bearCol - removedCollateral)), DataEntry(bearCirculationKey, (bearCirc - removedTokens)), DataEntry(headPointerKey, next), collectFee(feeSize), decreaseQueueSize] | |
218 | 224 | ScriptResult(WriteSet(if (isLastElement) | |
219 | 225 | then overwriteTail :: items | |
220 | 226 | else items), TransferSet([ScriptTransfer(invoker, payout, fromBase58String(mainToken))])) | |
221 | 227 | } | |
222 | 228 | else throw("bad token id") | |
223 | 229 | } | |
224 | 230 | else throw(("bad action: " + action)) | |
225 | 231 | } | |
226 | 232 | ||
227 | 233 | ||
228 | 234 | func rebalance () = { | |
229 | 235 | func LV (v,p0,p1) = { | |
230 | 236 | let denom = 100 | |
231 | 237 | let pmax = ((if ((p1 > p0)) | |
232 | 238 | then p1 | |
233 | 239 | else p0) / denom) | |
234 | 240 | let pmin = ((if ((p0 > p1)) | |
235 | 241 | then p1 | |
236 | 242 | else p0) / denom) | |
237 | 243 | let a = (pmin * pmin) | |
238 | 244 | let b = (((9 * pmax) * pmax) - ((15 * pmax) * pmin)) | |
239 | 245 | fraction(v, ((6 * a) + b), ((7 * a) + b)) | |
240 | 246 | } | |
241 | 247 | ||
242 | - | let settledPriceId = valueOrErrorMessage(getInteger(this, lastRebalancePriceIdKey), "inconsistent data") | |
243 | - | let unsettledPriceId = (settledPriceId + 1) | |
244 | - | let settledPrice = valueOrErrorMessage(getInteger(oracle, toString(settledPriceId)), "bad oracle data for sellted price") | |
245 | - | let nextPrice = valueOrErrorMessage(getInteger(oracle, toString(unsettledPriceId)), "no next price") | |
248 | + | let settledPriceIndex = valueOrErrorMessage(getInteger(this, lastRebalancePriceIndexKey), "inconsistent data") | |
249 | + | let unsettledPriceIndex = (settledPriceIndex + 1) | |
250 | + | let settledPriceHeight = valueOrErrorMessage(getInteger(oracle, ("price_index_" + toString(settledPriceIndex))), "bad oracle data for settled price height") | |
251 | + | let settledPrice = valueOrErrorMessage(getInteger(oracle, ("price_" + toString(settledPriceHeight))), "bad oracle data for price") | |
252 | + | let nextPriceHeight = valueOrErrorMessage(getInteger(oracle, ("price_index_" + toString(unsettledPriceIndex))), "no next price height") | |
253 | + | let nextPrice = valueOrErrorMessage(getInteger(oracle, ("price_" + toString(nextPriceHeight))), "no next price") | |
246 | 254 | let minVol = if ((bearCol > bullCol)) | |
247 | 255 | then bullCol | |
248 | 256 | else bearCol | |
249 | 257 | let redist = LV(minVol, settledPrice, nextPrice) | |
250 | 258 | if ((nextPrice > settledPrice)) | |
251 | - | then WriteSet([DataEntry(bullCollateralKey, (bullCol + redist)), DataEntry(bearCollateralKey, (bearCol - redist)), DataEntry( | |
259 | + | then WriteSet([DataEntry(bullCollateralKey, (bullCol + redist)), DataEntry(bearCollateralKey, (bearCol - redist)), DataEntry(lastRebalancePriceIndexKey, unsettledPriceIndex)]) | |
252 | 260 | else if ((settledPrice > nextPrice)) | |
253 | - | then WriteSet([DataEntry(bullCollateralKey, (bullCol - redist)), DataEntry(bearCollateralKey, (bearCol + redist)), DataEntry( | |
254 | - | else WriteSet([DataEntry( | |
261 | + | then WriteSet([DataEntry(bullCollateralKey, (bullCol - redist)), DataEntry(bearCollateralKey, (bearCol + redist)), DataEntry(lastRebalancePriceIndexKey, unsettledPriceIndex)]) | |
262 | + | else WriteSet([DataEntry(lastRebalancePriceIndexKey, unsettledPriceIndex)]) | |
255 | 263 | } | |
256 | 264 | ||
257 | 265 | ||
258 | 266 | @Callable(inv) | |
259 | 267 | func init (bullId,bearId,mainTokenId,oraclePK,whitelisted) = if (isDefined(getString(this, BULLKey))) | |
260 | 268 | then throw("already initialized") | |
261 | 269 | else if (!(isDefined(inv.payment))) | |
262 | 270 | then throw("neutrino payment required") | |
263 | 271 | else if ((toBase58String(valueOrErrorMessage(value(inv.payment).assetId, "neutrino payment required")) != mainTokenId)) | |
264 | 272 | then throw("payment not in neutrino") | |
265 | 273 | else { | |
266 | 274 | let totalOwnedMainToken = value(inv.payment).amount | |
267 | 275 | let bulls = (totalOwnedMainToken / 2) | |
268 | 276 | let bears = (totalOwnedMainToken - bulls) | |
269 | 277 | if (if ((bears == 0)) | |
270 | 278 | then true | |
271 | 279 | else (bulls == 0)) | |
272 | 280 | then throw("can't init balances") | |
273 | 281 | else { | |
274 | - | let | |
275 | - | ScriptResult(WriteSet([DataEntry(BULLKey, bullId), DataEntry(BEARKey, bearId), DataEntry(mainTokenKey, mainTokenId), DataEntry(oraclePKKey, oraclePK), DataEntry(bullCollateralKey, bulls), DataEntry(bearCollateralKey, bears), DataEntry(bullCirculationKey, bulls), DataEntry(bearCirculationKey, bears), DataEntry( | |
282 | + | let oracleCurrentPriceIndex = valueOrErrorMessage(getInteger(valueOrErrorMessage(addressFromPublicKey(fromBase58String(oraclePK)), "bad oracle address"), oracleCurrentPriceIndexKey), "can't find oracle price id") | |
283 | + | ScriptResult(WriteSet([DataEntry(BULLKey, bullId), DataEntry(BEARKey, bearId), DataEntry(mainTokenKey, mainTokenId), DataEntry(oraclePKKey, oraclePK), DataEntry(bullCollateralKey, bulls), DataEntry(bearCollateralKey, bears), DataEntry(bullCirculationKey, bulls), DataEntry(bearCirculationKey, bears), DataEntry(lastRebalancePriceIndexKey, oracleCurrentPriceIndex), DataEntry(whitelistKey, whitelisted), DataEntry(issuePercentileKey, 0), DataEntry(redeemPercentileKey, 0), DataEntry(minIssueKey, 0), DataEntry(minRedeemKey, 0), DataEntry(whitelistOnlyKey, true)]), TransferSet([ScriptTransfer(inv.caller, bulls, fromBase58String(bullId)), ScriptTransfer(inv.caller, bears, fromBase58String(bearId))])) | |
276 | 284 | } | |
277 | 285 | } | |
278 | 286 | ||
279 | 287 | ||
280 | 288 | ||
281 | 289 | @Callable(i) | |
282 | 290 | func setParams (iP,rP,mI,mR,wl) = if ((i.caller != this)) | |
283 | 291 | then throw("only self can change whitelist") | |
284 | 292 | else WriteSet([DataEntry(issuePercentileKey, iP), DataEntry(redeemPercentileKey, rP), DataEntry(minIssueKey, mI), DataEntry(minRedeemKey, mR), DataEntry(whitelistOnlyKey, wl)]) | |
285 | 293 | ||
286 | 294 | ||
287 | 295 | ||
288 | 296 | @Callable(i) | |
289 | 297 | func setWhitelist (l) = if ((i.caller != this)) | |
290 | 298 | then throw("only self can change whitelist") | |
291 | 299 | else WriteSet([DataEntry(whitelistKey, l)]) | |
292 | 300 | ||
293 | 301 | ||
294 | 302 | ||
295 | 303 | @Callable(inv) | |
296 | 304 | func requestRedeem () = if ((validateEnqueue(inv) == unit)) | |
297 | 305 | then { | |
298 | 306 | let assetId = toBase58String(valueOrErrorMessage(value(inv.payment).assetId, "waves are not accepted here")) | |
299 | - | enqueue(toBase58String(inv.transactionId), REDEEM, value(inv.payment).amount, assetId, ( | |
307 | + | enqueue(toBase58String(inv.transactionId), REDEEM, value(inv.payment).amount, assetId, (oraclePriceIndex + 1), toString(inv.caller)) | |
300 | 308 | } | |
301 | 309 | else throw("doesn't happen") | |
302 | 310 | ||
303 | 311 | ||
304 | 312 | ||
305 | 313 | @Callable(inv) | |
306 | 314 | func requestIssue (tokenId) = if ((inv.caller == this)) | |
307 | 315 | then throw("can't do") | |
308 | 316 | else if (if (whitelistOnly) | |
309 | 317 | then !(isDefined(indexOf(whitelist, toString(inv.caller)))) | |
310 | 318 | else false) | |
311 | 319 | then throw("only whitelisted can do") | |
312 | 320 | else { | |
313 | 321 | let errorMessage = throw((((((("only BULL(" + BULL) + ") or BEAR(") + BEAR) + ") tokens are available in exchange for USDN(") + mainToken) + ")")) | |
314 | 322 | if (if ((tokenId != BULL)) | |
315 | 323 | then (tokenId != BEAR) | |
316 | 324 | else false) | |
317 | 325 | then errorMessage | |
318 | 326 | else if (!(isDefined(inv.payment))) | |
319 | 327 | then errorMessage | |
320 | 328 | else if ((value(inv.payment).assetId != fromBase58String(mainToken))) | |
321 | 329 | then errorMessage | |
322 | 330 | else if ((minIssue > value(inv.payment).amount)) | |
323 | 331 | then throw((("Attached payment too small. Min required: " + toString((minIssue / 1000000))) + " USDN")) | |
324 | - | else enqueue(toBase58String(inv.transactionId), ISSUE, value(inv.payment).amount, tokenId, ( | |
332 | + | else enqueue(toBase58String(inv.transactionId), ISSUE, value(inv.payment).amount, tokenId, (oraclePriceIndex + 1), toString(inv.caller)) | |
325 | 333 | } | |
326 | 334 | ||
327 | 335 | ||
328 | 336 | ||
329 | 337 | @Callable(inv) | |
330 | 338 | func settle () = { | |
331 | 339 | let queueEmpty = (headPointer == "") | |
332 | - | let canRebalance = ( | |
340 | + | let canRebalance = (oraclePriceIndex > rebalancedPriceIndex) | |
333 | 341 | if (queueEmpty) | |
334 | 342 | then if (canRebalance) | |
335 | 343 | then rebalance() | |
336 | 344 | else throw("[OK] all done, carry on") | |
337 | 345 | else { | |
338 | 346 | let data = split(valueOrErrorMessage(getString(this, headPointer), "bad head pointer"), "|") | |
339 | - | let | |
340 | - | if (( | |
347 | + | let priceIndex = parseIntValue(data[3]) | |
348 | + | if ((priceIndex > rebalancedPriceIndex)) | |
341 | 349 | then if (canRebalance) | |
342 | 350 | then rebalance() | |
343 | 351 | else throw("[OK] need to wait") | |
344 | - | else if (( | |
352 | + | else if ((priceIndex == rebalancedPriceIndex)) | |
345 | 353 | then dequeue() | |
346 | 354 | else throw("corrupt data, future price id already rebalanced") | |
347 | 355 | } | |
348 | 356 | } | |
349 | 357 | ||
350 | 358 |
github/deemru/w8io/026f985 61.90 ms ◑