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