@sora-substrate/liquidity-proxy
Advanced tools
Comparing version 1.34.7 to 1.34.8
{ | ||
"name": "@sora-substrate/liquidity-proxy", | ||
"version": "1.34.7", | ||
"version": "1.34.8", | ||
"license": "Apache-2.0", | ||
@@ -11,4 +11,4 @@ "main": "./build/index.js", | ||
"dependencies": { | ||
"@sora-substrate/math": "1.34.7" | ||
"@sora-substrate/math": "1.34.8" | ||
} | ||
} |
@@ -154,2 +154,5 @@ "use strict"; | ||
const xykQuoteC = (input, output, x, y, yOut, deduceFee) => { | ||
if (_math.FPNumber.isGreaterThanOrEqualTo(yOut, y)) { | ||
throw new Error(`[liquidityProxy] xykQuote: output amount ${yOut.toString()} is larger than reserves ${y.toString()}. `); | ||
} | ||
const fxwYout = yOut.add(_math.FPNumber.fromCodecValue(1)); // by 1 correction to overestimate required input | ||
@@ -186,2 +189,5 @@ const nominator = x.mul(fxwYout); | ||
const yOutWithFee = deduceFee ? (0, _utils.safeDivide)(fxwYout, _math.FPNumber.ONE.sub(_consts.Consts.XYK_FEE)) : fxwYout; | ||
if (_math.FPNumber.isGreaterThanOrEqualTo(yOutWithFee, y)) { | ||
throw new Error(`[liquidityProxy] xykQuote: output amount ${yOutWithFee.toString()} is larger than reserves ${y.toString()}.`); | ||
} | ||
const nominator = x.mul(yOutWithFee); | ||
@@ -188,0 +194,0 @@ const denominator = y.sub(yOutWithFee); |
{ | ||
"name": "@sora-substrate/liquidity-proxy", | ||
"version": "1.34.7", | ||
"version": "1.34.8", | ||
"license": "Apache-2.0", | ||
@@ -11,5 +11,5 @@ "main": "./build/index.js", | ||
"dependencies": { | ||
"@sora-substrate/math": "1.34.7" | ||
"@sora-substrate/math": "1.34.8" | ||
}, | ||
"gitHead": "a86896ec7c2b08d91fdd1962534fd64fb97af8d9" | ||
"gitHead": "e6364103567c5de0fa701cc4df25c426ef32d112" | ||
} |
@@ -223,2 +223,8 @@ import { FPNumber } from '@sora-substrate/math'; | ||
): QuoteResult => { | ||
if (FPNumber.isGreaterThanOrEqualTo(yOut, y)) { | ||
throw new Error( | ||
`[liquidityProxy] xykQuote: output amount ${yOut.toString()} is larger than reserves ${y.toString()}. ` | ||
); | ||
} | ||
const fxwYout = yOut.add(FPNumber.fromCodecValue(1)); // by 1 correction to overestimate required input | ||
@@ -266,2 +272,8 @@ const nominator = x.mul(fxwYout); | ||
if (FPNumber.isGreaterThanOrEqualTo(yOutWithFee, y)) { | ||
throw new Error( | ||
`[liquidityProxy] xykQuote: output amount ${yOutWithFee.toString()} is larger than reserves ${y.toString()}.` | ||
); | ||
} | ||
const nominator = x.mul(yOutWithFee); | ||
@@ -268,0 +280,0 @@ const denominator = y.sub(yOutWithFee); |
271589
6409
+ Added@sora-substrate/math@1.34.8(transitive)
- Removed@sora-substrate/math@1.34.7(transitive)
Updated@sora-substrate/math@1.34.8