Skip to content

Commit

Permalink
v13.15.1: fixes uniswapV3 liquidity check for smaller amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Dec 26, 2024
1 parent 6c13403 commit e75cedd
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dist/esm/index.evm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4675,14 +4675,14 @@ const getBestPool = async ({ blockchain, exchange, path, amountIn, amountOut, bl
const amountScaled = await getOutputAmount({ exchange, pool, inputAmount: ethers.BigNumber.from(amountIn).mul(ethers.BigNumber.from(10)).toString() });
const amountScaledDown = amountScaled.div(ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.BigNumber.from(100)).mul(ethers.BigNumber.from(5))); // up to 5% diff allowed
const enoughLiquidity = !difference.gt(amount.mul(ethers.BigNumber.from(5)).div(ethers.BigNumber.from(100))); // up to 5% diff allowed
if(!enoughLiquidity) { return }
} else {
amount = await getInputAmount({ exchange, pool, outputAmount: amountOut });
const amountScaled = await getInputAmount({ exchange, pool, outputAmount: ethers.BigNumber.from(amountOut).mul(ethers.BigNumber.from(10)).toString() });
const amountScaledDown = amountScaled.div(ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.BigNumber.from(100)).mul(ethers.BigNumber.from(5))); // up to 5% diff allowed
const enoughLiquidity = !difference.gt(amount.mul(ethers.BigNumber.from(5)).div(ethers.BigNumber.from(100))); // up to 5% diff allowed
if(!enoughLiquidity) { return }
}

Expand Down
4 changes: 2 additions & 2 deletions dist/umd/index.evm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4680,14 +4680,14 @@
const amountScaled = await getOutputAmount({ exchange, pool, inputAmount: ethers.ethers.BigNumber.from(amountIn).mul(ethers.ethers.BigNumber.from(10)).toString() });
const amountScaledDown = amountScaled.div(ethers.ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.ethers.BigNumber.from(100)).mul(ethers.ethers.BigNumber.from(5))); // up to 5% diff allowed
const enoughLiquidity = !difference.gt(amount.mul(ethers.ethers.BigNumber.from(5)).div(ethers.ethers.BigNumber.from(100))); // up to 5% diff allowed
if(!enoughLiquidity) { return }
} else {
amount = await getInputAmount({ exchange, pool, outputAmount: amountOut });
const amountScaled = await getInputAmount({ exchange, pool, outputAmount: ethers.ethers.BigNumber.from(amountOut).mul(ethers.ethers.BigNumber.from(10)).toString() });
const amountScaledDown = amountScaled.div(ethers.ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.ethers.BigNumber.from(100)).mul(ethers.ethers.BigNumber.from(5))); // up to 5% diff allowed
const enoughLiquidity = !difference.gt(amount.mul(ethers.ethers.BigNumber.from(5)).div(ethers.ethers.BigNumber.from(100))); // up to 5% diff allowed
if(!enoughLiquidity) { return }
}

Expand Down
2 changes: 1 addition & 1 deletion package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-exchanges-evm",
"moduleName": "Web3Exchanges",
"version": "13.15.0",
"version": "13.15.1",
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
"main": "dist/umd/index.evm.js",
"module": "dist/esm/index.evm.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-exchanges",
"moduleName": "Web3Exchanges",
"version": "13.15.0",
"version": "13.15.1",
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/web3-exchanges-solana",
"moduleName": "Web3Exchanges",
"version": "13.15.0",
"version": "13.15.1",
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
"main": "dist/umd/index.solana.js",
"module": "dist/esm/index.solana.js",
Expand Down
4 changes: 2 additions & 2 deletions src/platforms/evm/uniswap_v3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e75cedd

Please sign in to comment.