tx · CDRkiBJfw7ETkATcfUYJhhoEuWj26Bm2RZsjHw9X3Tau 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi: -0.01400000 Waves 2022.03.18 10:35 [1969106] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves
{ "type": 13, "id": "CDRkiBJfw7ETkATcfUYJhhoEuWj26Bm2RZsjHw9X3Tau", "fee": 1400000, "feeAssetId": null, "timestamp": 1647588948594, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "FcvW39K5JixABsSSG6C5QrgHF9Y1qTZnWTgmfzV1FQ358SWwo2QpRdu2FGCaNVjWCfDoCPdqig737CoqcYvr9ZQ" ], "script": "base64:AAIFAAAAAAAAADMIAhIFCgMICAESAwoBARIHCgUBAQEBARIDCgEBEgMKAQESABIFCgMBAQESBwoFAQEBAQEAAAAvAAAAAAdXQVZFTEVUAAAAAAAF9eEAAAAAAAVQQVVMSQAAAAAAAA9CQAAAAAAIQklHUEFVTEkJAAE2AAAAAQAAAAAAAA9CQAAAAAAIUFJJQ0VMRVQAAAAAAAAPQkAAAAAABE1VTFQAAAAAAAX14QAAAAAACUJJR01VTFQxNgkAATYAAAABAAAjhvJvwQAAAAAAAAlNVUxUU0NBTEUAAAAAAAAAAAgAAAAAB1NDQUxFMTYAAAAAAAAAABAAAAAAA1NFUAIAAAACX18AAAAABUhBTEY4AAAAAAAC+vCAAAAAAAtFVUxFUk5VTUJFUgkAATYAAAABAABgkqET2NV0AAAAAAZzY2FsZTYAAAAAAAAPQkAAAAAADHNjYWxlNkJpZ0ludAkAATYAAAABAAAAAAAAD0JAAAAAAAxzY2FsZThCaWdJbnQJAAE2AAAAAQAAAAAABfXhAAAAAAANc2NhbGUxMEJpZ0ludAkAATYAAAABAAAAAAJUC+QAAQAAABJrZXlOZXV0cmlub0FkZH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AgUAAAADbmlsCQAAawAAAAMFAAAABmFtb3VudAkAAGwAAAAGAAAAAAAAAAACAAAAAAAAAAAACQAAawAAAAMJAQAAAAEtAAAAAQkAAGUAAAACBQAAAAZoZWlnaHQFAAAAC3N0YXJ0SGVpZ2h0BQAAAARNVUxUBQAAAAhoYWxmTGlmZQAAAAAAAAAACAAAAAAAAAAACAUAAAAGSEFMRlVQBQAAAARNVUxUAAAAAWkBAAAAE21lcmdlU3Rha2VzUkVBRE9OTFkAAAAFAAAAB2Ftb3VudDEAAAAHaGVpZ2h0MQAAAAdhbW91bnQyAAAAB2hlaWdodDIAAAAIaGFsZkxpZmUEAAAAAXcJAABrAAAAAwUAAAAHYW1vdW50MgkAAGwAAAAGAAAAAAAAAAACAAAAAAAAAAAACQAAawAAAAMJAABlAAAAAgUAAAAHaGVpZ2h0MgUAAAAHaGVpZ2h0MQUAAAAETVVMVAUAAAAIaGFsZkxpZmUAAAAAAAAAAAgAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAQAAAABdgkAAGsAAAADCQAAZAAAAAIFAAAAB2Ftb3VudDEFAAAAB2Ftb3VudDIFAAAABE1VTFQJAABkAAAAAgUAAAAHYW1vdW50MQUAAAABdwkABRQAAAACBQAAAANuaWwJAABkAAAAAgUAAAAHaGVpZ2h0MQkAAGkAAAACCQAAZQAAAAIFAAAABUhBTEY4CQAAaAAAAAIFAAAACGhhbGZMaWZlCQAAbQAAAAYFAAAAAXYAAAAAAAAAAAgAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAAAAAB3r7vC", "chainId": 84, "height": 1969106, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B5PKtkw2C9MdNE1Mz2x7qHVWpi26LDXcfH67Bm5GGjrU Next: HCUkraKw7BiYJp6rQ3rRi2P5mpg6Y7UarD1RWHeSefNY Diff:
Old | New | Differences | |
---|---|---|---|
133 | 133 | ||
134 | 134 | let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId())) | |
135 | 135 | ||
136 | - | func calcContractNsbtPriceInternal (nsbtSupplyOverride) = { | |
137 | - | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
136 | + | func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = { | |
138 | 137 | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
139 | - | if ((neutrinoMetrics == neutrinoMetrics)) | |
140 | - | then { | |
141 | - | let nsbtSupply = if ((nsbtSupplyOverride == unit)) | |
142 | - | then asInt(neutrinoMetrics[9]) | |
143 | - | else value(nsbtSupplyOverride) | |
144 | - | let currentPrice = asInt(neutrinoMetrics[0]) | |
145 | - | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[3]), asInt(neutrinoMetrics[5]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil)) | |
146 | - | if ((kCalcArray == kCalcArray)) | |
147 | - | then { | |
148 | - | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
149 | - | let mK = fromX16(multK, MULT) | |
150 | - | let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply)) | |
151 | - | let multStep2 = fraction(multStep1, multStep1, MULT) | |
152 | - | let multNsbt2usdnPrice = fraction(mK, multStep2, MULT) | |
153 | - | let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT) | |
154 | - | let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice) | |
155 | - | $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice]) | |
156 | - | } | |
157 | - | else throw("Strict value is not equal to itself.") | |
158 | - | } | |
159 | - | else throw("Strict value is not equal to itself.") | |
138 | + | let price = asInt(neutrinoMetrics[0]) | |
139 | + | let wRaw = asInt(neutrinoMetrics[3]) | |
140 | + | let uRaw = asInt(neutrinoMetrics[5]) | |
141 | + | let sRaw = (asInt(neutrinoMetrics[9]) + nsbtSupplyDELTA) | |
142 | + | let mRaw = asInt(neutrinoMetrics[10]) | |
143 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
144 | + | let multKX16 = parseBigIntValue(asString(kCalcArray[6])) | |
145 | + | let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw))) | |
146 | + | let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16) | |
147 | + | let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16) | |
148 | + | let nsbt2usdnPrice = toInt(fraction(multNsbt2usdnPriceX16, toBigInt(PAULI), BIGMULT16)) | |
149 | + | let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, price) | |
150 | + | $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice]) | |
160 | 151 | } | |
161 | 152 | ||
162 | 153 | ||
201 | 192 | @Callable(i) | |
202 | 193 | func curveFunctionREADONLY (wavesPayRaw) = { | |
203 | 194 | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
204 | - | if ((neutrinoMetrics == neutrinoMetrics)) | |
205 | - | then { | |
206 | - | let price = asInt(neutrinoMetrics[0]) | |
207 | - | let wRaw = asInt(neutrinoMetrics[3]) | |
208 | - | let uRaw = asInt(neutrinoMetrics[5]) | |
209 | - | let sRaw = asInt(neutrinoMetrics[9]) | |
210 | - | let mRaw = value(assetInfo(nsbtAssetId)).quantity | |
211 | - | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
212 | - | if ((kCalcArray == kCalcArray)) | |
213 | - | then { | |
214 | - | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
215 | - | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
216 | - | let bigMaxNsbtSupply = toBigInt(mRaw) | |
217 | - | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
218 | - | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
219 | - | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
220 | - | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
221 | - | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
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 | - | } | |
224 | - | else throw("Strict value is not equal to itself.") | |
225 | - | } | |
226 | - | else throw("Strict value is not equal to itself.") | |
195 | + | let price = asInt(neutrinoMetrics[0]) | |
196 | + | let wRaw = asInt(neutrinoMetrics[3]) | |
197 | + | let uRaw = asInt(neutrinoMetrics[5]) | |
198 | + | let sRaw = asInt(neutrinoMetrics[9]) | |
199 | + | let mRaw = asInt(neutrinoMetrics[10]) | |
200 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
201 | + | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
202 | + | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
203 | + | let bigMaxNsbtSupply = toBigInt(mRaw) | |
204 | + | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
205 | + | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
206 | + | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
207 | + | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
208 | + | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
209 | + | $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]) | |
227 | 210 | } | |
228 | 211 | ||
229 | 212 | ||
230 | 213 | ||
231 | 214 | @Callable(i) | |
232 | - | func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit) | |
233 | - | ||
234 | - | ||
235 | - | ||
236 | - | @Callable(i) | |
237 | - | func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply) | |
215 | + | func calcContractNsbtPriceSYSREADONLY (nsbtSupplyDELTA) = calcContractNsbtPriceInternal(nsbtSupplyDELTA) | |
238 | 216 | ||
239 | 217 | ||
240 | 218 |
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 | - | func calcContractNsbtPriceInternal (nsbtSupplyOverride) = { | |
137 | - | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
136 | + | func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = { | |
138 | 137 | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
139 | - | if ((neutrinoMetrics == neutrinoMetrics)) | |
140 | - | then { | |
141 | - | let nsbtSupply = if ((nsbtSupplyOverride == unit)) | |
142 | - | then asInt(neutrinoMetrics[9]) | |
143 | - | else value(nsbtSupplyOverride) | |
144 | - | let currentPrice = asInt(neutrinoMetrics[0]) | |
145 | - | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[3]), asInt(neutrinoMetrics[5]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil)) | |
146 | - | if ((kCalcArray == kCalcArray)) | |
147 | - | then { | |
148 | - | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
149 | - | let mK = fromX16(multK, MULT) | |
150 | - | let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply)) | |
151 | - | let multStep2 = fraction(multStep1, multStep1, MULT) | |
152 | - | let multNsbt2usdnPrice = fraction(mK, multStep2, MULT) | |
153 | - | let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT) | |
154 | - | let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice) | |
155 | - | $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice]) | |
156 | - | } | |
157 | - | else throw("Strict value is not equal to itself.") | |
158 | - | } | |
159 | - | else throw("Strict value is not equal to itself.") | |
138 | + | let price = asInt(neutrinoMetrics[0]) | |
139 | + | let wRaw = asInt(neutrinoMetrics[3]) | |
140 | + | let uRaw = asInt(neutrinoMetrics[5]) | |
141 | + | let sRaw = (asInt(neutrinoMetrics[9]) + nsbtSupplyDELTA) | |
142 | + | let mRaw = asInt(neutrinoMetrics[10]) | |
143 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
144 | + | let multKX16 = parseBigIntValue(asString(kCalcArray[6])) | |
145 | + | let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw))) | |
146 | + | let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16) | |
147 | + | let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16) | |
148 | + | let nsbt2usdnPrice = toInt(fraction(multNsbt2usdnPriceX16, toBigInt(PAULI), BIGMULT16)) | |
149 | + | let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, price) | |
150 | + | $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice]) | |
160 | 151 | } | |
161 | 152 | ||
162 | 153 | ||
163 | 154 | @Callable(i) | |
164 | 155 | func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this)) | |
165 | 156 | then throw("not authorized") | |
166 | 157 | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)] | |
167 | 158 | ||
168 | 159 | ||
169 | 160 | ||
170 | 161 | @Callable(i) | |
171 | 162 | func calcSwapLimitREADONLY (gNsbtAmount) = { | |
172 | 163 | let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam())) | |
173 | 164 | let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6) | |
174 | 165 | let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING) | |
175 | 166 | let limit = fraction(limitParamA, limitPowPart, scale10BigInt) | |
176 | 167 | $Tuple2(nil, toInt(limit)) | |
177 | 168 | } | |
178 | 169 | ||
179 | 170 | ||
180 | 171 | ||
181 | 172 | @Callable(i) | |
182 | 173 | func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = { | |
183 | 174 | let EXP = toBigInt(2718281) | |
184 | 175 | let EXPSCALE = 6 | |
185 | 176 | let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3) | |
186 | 177 | let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10)) | |
187 | 178 | let wReservesInUsdn = convertWavesToNeutrino(wRaw, price) | |
188 | 179 | let multBR = fraction(wReservesInUsdn, MULT, uRaw) | |
189 | 180 | if ((multBR > 10678564816)) | |
190 | 181 | then throw("BR > 10678.564816% will overflow exponent") | |
191 | 182 | else { | |
192 | 183 | let multPower = (a * (multBR - MULT)) | |
193 | 184 | let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN) | |
194 | 185 | let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI) | |
195 | 186 | $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)]) | |
196 | 187 | } | |
197 | 188 | } | |
198 | 189 | ||
199 | 190 | ||
200 | 191 | ||
201 | 192 | @Callable(i) | |
202 | 193 | func curveFunctionREADONLY (wavesPayRaw) = { | |
203 | 194 | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
204 | - | if ((neutrinoMetrics == neutrinoMetrics)) | |
205 | - | then { | |
206 | - | let price = asInt(neutrinoMetrics[0]) | |
207 | - | let wRaw = asInt(neutrinoMetrics[3]) | |
208 | - | let uRaw = asInt(neutrinoMetrics[5]) | |
209 | - | let sRaw = asInt(neutrinoMetrics[9]) | |
210 | - | let mRaw = value(assetInfo(nsbtAssetId)).quantity | |
211 | - | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
212 | - | if ((kCalcArray == kCalcArray)) | |
213 | - | then { | |
214 | - | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
215 | - | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
216 | - | let bigMaxNsbtSupply = toBigInt(mRaw) | |
217 | - | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
218 | - | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
219 | - | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
220 | - | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
221 | - | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
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 | - | } | |
224 | - | else throw("Strict value is not equal to itself.") | |
225 | - | } | |
226 | - | else throw("Strict value is not equal to itself.") | |
195 | + | let price = asInt(neutrinoMetrics[0]) | |
196 | + | let wRaw = asInt(neutrinoMetrics[3]) | |
197 | + | let uRaw = asInt(neutrinoMetrics[5]) | |
198 | + | let sRaw = asInt(neutrinoMetrics[9]) | |
199 | + | let mRaw = asInt(neutrinoMetrics[10]) | |
200 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
201 | + | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
202 | + | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
203 | + | let bigMaxNsbtSupply = toBigInt(mRaw) | |
204 | + | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
205 | + | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
206 | + | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
207 | + | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
208 | + | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
209 | + | $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]) | |
227 | 210 | } | |
228 | 211 | ||
229 | 212 | ||
230 | 213 | ||
231 | 214 | @Callable(i) | |
232 | - | func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit) | |
233 | - | ||
234 | - | ||
235 | - | ||
236 | - | @Callable(i) | |
237 | - | func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply) | |
215 | + | func calcContractNsbtPriceSYSREADONLY (nsbtSupplyDELTA) = calcContractNsbtPriceInternal(nsbtSupplyDELTA) | |
238 | 216 | ||
239 | 217 | ||
240 | 218 | ||
241 | 219 | @Callable(i) | |
242 | 220 | func calcNeutinoMetricsREADONLY () = { | |
243 | 221 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
244 | 222 | let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0) | |
245 | 223 | let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0) | |
246 | 224 | let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance) | |
247 | 225 | let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice) | |
248 | 226 | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
249 | 227 | let surplus = (reservesInUsdn - neutrinoSupply) | |
250 | 228 | let deficit = (neutrinoSupply - reservesInUsdn) | |
251 | 229 | let surplusPercent = if ((neutrinoSupply == 0)) | |
252 | 230 | then 0 | |
253 | 231 | else (fraction(surplus, PAULI, neutrinoSupply) * 100) | |
254 | 232 | let BR = if ((neutrinoSupply == 0)) | |
255 | 233 | then 0 | |
256 | 234 | else fraction(reservesInUsdn, PAULI, neutrinoSupply) | |
257 | 235 | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
258 | 236 | let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId)) | |
259 | 237 | $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX]) | |
260 | 238 | } | |
261 | 239 | ||
262 | 240 | ||
263 | 241 | ||
264 | 242 | @Callable(i) | |
265 | 243 | func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT)) | |
266 | 244 | ||
267 | 245 | ||
268 | 246 | ||
269 | 247 | @Callable(i) | |
270 | 248 | func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = { | |
271 | 249 | let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT) | |
272 | 250 | let v = fraction((amount1 + amount2), MULT, (amount1 + w)) | |
273 | 251 | $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT))) | |
274 | 252 | } | |
275 | 253 | ||
276 | 254 |
github/deemru/w8io/026f985 57.01 ms ◑