tx · 5LQET3pBXKVNvZRW6v9Gjt9EyMRGBB9ndrPrrrP2kmaV 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi: -0.01400000 Waves 2022.03.24 09:26 [1977639] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves
{ "type": 13, "id": "5LQET3pBXKVNvZRW6v9Gjt9EyMRGBB9ndrPrrrP2kmaV", "fee": 1400000, "feeAssetId": null, "timestamp": 1648103224472, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "2GDnH1kcpVpW1eMyYebWVZM3pJ67StnMiKrr7XRVeLJyuiAZ7AcftXE8beD6236s1reHzJErcbLzh8x4QnjfukXw" ], "script": "base64:AAIFAAAAAAAAADMIAhIFCgMICAESAwoBARIHCgUBAQEBARIDCgEBEgMKAQESABIFCgMBAQESBwoFAQEBAQEAAABBAAAAAAdXQVZFTEVUAAAAAAAF9eEAAAAAAAVQQVVMSQAAAAAAAA9CQAAAAAAIQklHUEFVTEkJAAE2AAAAAQAAAAAAAA9CQAAAAAAIUFJJQ0VMRVQAAAAAAAAPQkAAAAAABE1VTFQAAAAAAAX14QAAAAAACUJJR01VTFQxNgkAATYAAAABAAAjhvJvwQAAAAAAAAlNVUxUU0NBTEUAAAAAAAAAAAgAAAAAB1NDQUxFMTYAAAAAAAAAABAAAAAAA1NFUAIAAAACX18AAAAABUhBTEY4AAAAAAAC+vCAAAAAAAtFVUxFUk5VTUJFUgkAATYAAAABAABgkqET2NV0AAAAAAZzY2FsZTYAAAAAAAAPQkAAAAAADHNjYWxlNkJpZ0ludAkAATYAAAABAAAAAAAAD0JAAAAAAAxzY2FsZThCaWdJbnQJAAE2AAAAAQAAAAAABfXhAAAAAAANc2NhbGUxMEJpZ0ludAkAATYAAAABAAAAAAJUC+QAAAAAAAtrUmVzdWx0SWR4QQAAA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original | compacted Prev: HCUkraKw7BiYJp6rQ3rRi2P5mpg6Y7UarD1RWHeSefNY Next: BiJZqwsb8TzNFBkn62N2iP3H3Lh9RsKrcqwrpvPnkwfK Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WAVELET = 100000000 | |
5 | 5 | ||
6 | 6 | let PAULI = 1000000 | |
7 | 7 | ||
8 | 8 | let BIGPAULI = toBigInt(1000000) | |
9 | 9 | ||
10 | 10 | let PRICELET = 1000000 | |
11 | 11 | ||
12 | 12 | let MULT = 100000000 | |
13 | 13 | ||
14 | 14 | let BIGMULT16 = toBigInt(10000000000000000) | |
15 | 15 | ||
16 | 16 | let MULTSCALE = 8 | |
17 | 17 | ||
18 | 18 | let SCALE16 = 16 | |
19 | 19 | ||
20 | 20 | let SEP = "__" | |
21 | 21 | ||
22 | 22 | let HALF8 = 50000000 | |
23 | 23 | ||
24 | 24 | let EULERNUMBER = toBigInt(27182818284590452) | |
25 | 25 | ||
26 | 26 | let scale6 = 1000000 | |
27 | 27 | ||
28 | 28 | let scale6BigInt = toBigInt(1000000) | |
29 | 29 | ||
30 | 30 | let scale8BigInt = toBigInt(100000000) | |
31 | 31 | ||
32 | 32 | let scale10BigInt = toBigInt(10000000000) | |
33 | 33 | ||
34 | 34 | let kResultIdxA = 0 | |
35 | 35 | ||
36 | 36 | let kResultIdxPaulB = 1 | |
37 | 37 | ||
38 | 38 | let kResultIdxWReservesInUsdn = 2 | |
39 | 39 | ||
40 | 40 | let kResultIdxMultBR = 3 | |
41 | 41 | ||
42 | 42 | let kResultIdxMultPower = 4 | |
43 | 43 | ||
44 | 44 | let kResultIdxMultExpInPowerStr = 5 | |
45 | 45 | ||
46 | 46 | let kResultIdxMultKStr = 6 | |
47 | 47 | ||
48 | 48 | let nMetricIdxPrice = 0 | |
49 | 49 | ||
50 | 50 | let nMetricIdxUsdnLockedBalance = 1 | |
51 | 51 | ||
52 | 52 | let nMetricIdxWavesLockedBalance = 2 | |
53 | 53 | ||
54 | 54 | let nMetricIdxReserve = 3 | |
55 | 55 | ||
56 | 56 | let nMetricIdxReserveInUsdn = 4 | |
57 | 57 | ||
58 | 58 | let nMetricIdxUsdnSupply = 5 | |
59 | 59 | ||
60 | 60 | let nMetricIdxSurplus = 6 | |
61 | 61 | ||
62 | 62 | let nMetricIdxSurplusPercent = 7 | |
63 | 63 | ||
64 | 64 | let nMetricIdxBR = 8 | |
65 | 65 | ||
66 | 66 | let nMetricIdxNsbtSupply = 9 | |
67 | 67 | ||
68 | 68 | let nMetricIdxMaxNsbtSupply = 10 | |
69 | 69 | ||
70 | 70 | func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress" | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func keySwapAmountAParam () = "%s%s__config__swapAParam" | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func keyNeutrinoAssetId () = "neutrino_asset_id" | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func keyLiquidationContractAddress () = "liquidation_contract" | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func keyAuctionContract () = "auction_contract" | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func keyContolContract () = "control_contract" | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func keyBondAssetId () = "bond_asset_id" | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func keyBalanceLocked () = "balance_lock_" | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func keyWavesLockedBalance () = (keyBalanceLocked() + "waves") | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino") | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func swapsTimeframeKEY () = "swaps_timeframe" | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP) | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func keyPrice () = "price" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult)) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16)) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func asAnyList (val) = match val { | |
137 | 137 | case valAnyLyst: List[Any] => | |
138 | 138 | valAnyLyst | |
139 | 139 | case _ => | |
140 | 140 | throw("fail to cast into List[Any]") | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func asInt (val) = match val { | |
145 | 145 | case valInt: Int => | |
146 | 146 | valInt | |
147 | 147 | case _ => | |
148 | 148 | throw("fail to cast into Int") | |
149 | 149 | } | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func asString (val) = match val { | |
153 | 153 | case valStr: String => | |
154 | 154 | valStr | |
155 | 155 | case _ => | |
156 | 156 | throw("fail to cast into String") | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress())) | |
161 | 161 | ||
162 | 162 | let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract())) | |
163 | 163 | ||
164 | 164 | let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract())) | |
165 | 165 | ||
166 | 166 | let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress())) | |
167 | 167 | ||
168 | 168 | let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId())) | |
169 | 169 | ||
170 | 170 | let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId())) | |
171 | 171 | ||
172 | 172 | func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = { | |
173 | 173 | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
174 | 174 | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
175 | 175 | let wRaw = asInt(neutrinoMetrics[nMetricIdxReserve]) | |
176 | 176 | let uRaw = (asInt(neutrinoMetrics[nMetricIdxUsdnSupply]) - nsbtSupplyDELTA) | |
177 | 177 | let sRaw = (asInt(neutrinoMetrics[nMetricIdxNsbtSupply]) + nsbtSupplyDELTA) | |
178 | 178 | let mRaw = asInt(neutrinoMetrics[nMetricIdxMaxNsbtSupply]) | |
179 | 179 | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
180 | 180 | let multKX16 = parseBigIntValue(asString(kCalcArray[kResultIdxMultKStr])) | |
181 | 181 | let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw))) | |
182 | 182 | let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16) | |
183 | 183 | let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16) | |
184 | 184 | let nsbt2usdnPrice = toInt(fraction(multNsbt2usdnPriceX16, toBigInt(PAULI), BIGMULT16)) | |
185 | 185 | let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, price) | |
186 | 186 | $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice]) | |
187 | 187 | } | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | @Callable(i) | |
191 | 191 | func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this)) | |
192 | 192 | then throw("not authorized") | |
193 | 193 | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)] | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | ||
197 | 197 | @Callable(i) | |
198 | 198 | func calcSwapLimitREADONLY (gNsbtAmount) = { | |
199 | 199 | let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam())) | |
200 | 200 | let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6) | |
201 | 201 | let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING) | |
202 | 202 | let limit = fraction(limitParamA, limitPowPart, scale10BigInt) | |
203 | 203 | $Tuple2(nil, toInt(limit)) | |
204 | 204 | } | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | ||
208 | 208 | @Callable(i) | |
209 | 209 | func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = { | |
210 | 210 | let EXP = toBigInt(2718281) | |
211 | 211 | let EXPSCALE = 6 | |
212 | 212 | let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3) | |
213 | 213 | let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10)) | |
214 | 214 | let wReservesInUsdn = convertWavesToNeutrino(wRaw, price) | |
215 | 215 | let multBR = fraction(wReservesInUsdn, MULT, uRaw) | |
216 | 216 | if ((multBR > 10678564816)) | |
217 | 217 | then throw("BR > 10678.564816% will overflow exponent") | |
218 | 218 | else { | |
219 | 219 | let multPower = (a * (multBR - MULT)) | |
220 | 220 | let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN) | |
221 | 221 | let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI) | |
222 | 222 | $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)]) | |
223 | 223 | } | |
224 | 224 | } | |
225 | 225 | ||
226 | 226 | ||
227 | 227 | ||
228 | 228 | @Callable(i) | |
229 | 229 | func curveFunctionREADONLY (wavesPayRaw) = { | |
230 | 230 | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
231 | 231 | let price = asInt(neutrinoMetrics[nMetricIdxPrice]) | |
232 | 232 | let wRaw = asInt(neutrinoMetrics[nMetricIdxReserve]) | |
233 | 233 | let uRaw = asInt(neutrinoMetrics[nMetricIdxUsdnSupply]) | |
234 | 234 | let sRaw = asInt(neutrinoMetrics[nMetricIdxNsbtSupply]) | |
235 | 235 | let mRaw = asInt(neutrinoMetrics[nMetricIdxMaxNsbtSupply]) | |
236 | 236 | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
237 | 237 | let multK = parseBigIntValue(asString(kCalcArray[kResultIdxMultKStr])) | |
238 | 238 | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
239 | 239 | let bigMaxNsbtSupply = toBigInt(mRaw) | |
240 | 240 | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
241 | 241 | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
242 | 242 | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
243 | 243 | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
244 | 244 | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
245 | 245 | $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[kResultIdxA]), asInt(kCalcArray[kResultIdxPaulB]), asInt(kCalcArray[kResultIdxWReservesInUsdn]), price, asInt(kCalcArray[kResultIdxMultBR]), asInt(kCalcArray[kResultIdxMultPower]), kCalcArray[kResultIdxMultExpInPowerStr], kCalcArray[kResultIdxMultKStr], toString(step1), toString(step2), step3]) | |
246 | 246 | } | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | ||
250 | 250 | @Callable(i) | |
251 | 251 | func calcContractNsbtPriceSYSREADONLY (nsbtSupplyDELTA) = calcContractNsbtPriceInternal(nsbtSupplyDELTA) | |
252 | 252 | ||
253 | 253 | ||
254 | 254 | ||
255 | 255 | @Callable(i) | |
256 | 256 | func calcNeutinoMetricsREADONLY () = { | |
257 | 257 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
258 | 258 | let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0) | |
259 | 259 | let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0) | |
260 | 260 | let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance) | |
261 | 261 | let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice) | |
262 | 262 | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
263 | 263 | let surplus = (reservesInUsdn - neutrinoSupply) | |
264 | 264 | let deficit = (neutrinoSupply - reservesInUsdn) | |
265 | 265 | let surplusPercent = if ((neutrinoSupply == 0)) | |
266 | 266 | then 0 | |
267 | 267 | else (fraction(surplus, PAULI, neutrinoSupply) * 100) | |
268 | 268 | let BR = if ((neutrinoSupply == 0)) | |
269 | 269 | then 0 | |
270 | 270 | else fraction(reservesInUsdn, PAULI, neutrinoSupply) | |
271 | 271 | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
272 | 272 | let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId)) | |
273 | 273 | $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX]) | |
274 | 274 | } | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | ||
278 | 278 | @Callable(i) | |
279 | 279 | func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT)) | |
280 | 280 | ||
281 | 281 | ||
282 | 282 | ||
283 | 283 | @Callable(i) | |
284 | 284 | func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = { | |
285 | 285 | let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT) | |
286 | 286 | let v = fraction((amount1 + amount2), MULT, (amount1 + w)) | |
287 | 287 | $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT))) | |
288 | 288 | } | |
289 | 289 | ||
290 | 290 |
github/deemru/w8io/026f985 38.58 ms ◑