{"_id":"@centfinance/cent.dex.sor-xdai","_rev":"3-038af115c07c423d7071f0fa44e379fb","name":"@centfinance/cent.dex.sor-xdai","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"@centfinance/cent.dex.sor-xdai","version":"0.0.1","license":"GPL-3.0-only","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc","test":"nyc mocha -r ts-node/register test/*.spec.ts","coverage":"nyc report --reporter=text-lcov | coveralls"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"devDependencies":{"@ethersproject/wallet":"^5.0.7","@types/chai":"^4.2.10","@types/mocha":"^7.0.2","@types/node":"^14.0.20","chai":"^4.2.0","coveralls":"^3.0.9","dotenv":"^8.2.0","husky":"^4.2.1","mocha":"^7.1.0","nyc":"^15.0.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","ts-node":"^8.6.2","typescript":"^3.8.3"},"dependencies":{"@ethersproject/address":"^5.0.5","@ethersproject/constants":"^5.0.5","@ethersproject/contracts":"^5.0.5","@ethersproject/providers":"5.0.12","@ethersproject/solidity":"^5.0.5","@ethersproject/units":"^5.0.6","bignumber.js":"^9.0.0","isomorphic-fetch":"^2.2.1"},"description":"There are two types of swap available:","_id":"@centfinance/cent.dex.sor-xdai@0.0.1","dist":{"shasum":"bba9a0da3e9baa223f21e647880d6c0473aa1f7d","integrity":"sha512-vdi2rg3iPnrruwbXPJCsNYBOdwHrodeDMFakAcZazSShxkYwznca/8a8WSOYQyQPmTmLMuQRU5gWxPZy4R49vQ==","tarball":"https://registry.npmjs.org/@centfinance/cent.dex.sor-xdai/-/cent.dex.sor-xdai-0.0.1.tgz","fileCount":30,"unpackedSize":151488,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgEXM8CRA9TVsSAnZWagAASM4P/iswu8serfRP9dOp977C\nRXziKMwKCgrnVtBY58/AduvKGU6QYw8OfekQeiuAZACJQ0kjfx2FKpuTID/s\nMw2QX5UFjblnJ/JmJqWHEAWnZVek1rHFqwi2jvxqpcaPCfrnALvFApqQKcPM\n/aN5QhrR05E2wJTTbNH/HHJ3xlCBy1JIYaA5MGpOiAcI1NiDgLt2by1Wa+CL\nAP1GxTaYLiQu0Z8F2BRVHM4RLMwWmyYDO/9Mf+NfIOBrCj908K15npojTBjy\nB+LgKr8/8voQGmccWRP3q7EUjU27NQHorxRLQKwON/3VrXk3vUdgIDd03L6y\nFIys2I9gCDdu40chk5lBy2d4t3Q/attcs9W/Qsr1nzag+fN7YnCZ3l188FlI\nPmHXSej/BZ9PxJakp3HXuGP6NYcwBdKtBYU0Bf2ZGzVpTyGw6dCSalJZxDpI\nBc43JjjqSg1WMWXaDeZD7lbDRFRTHb5zGvDM6rjRHyxiLjD43ZG8pYv0t11t\nXT8kDqtybrc3ad5DdxCIUQA9/WMwxdJImXowzikunictT7Uf0RrNmIt/QvpC\nh/QET6n+Y649KVKF/D5u301ez3udG3B5yHTMFwl/knGOv+jVF1xbu/WfELUF\niX1w+iIgiizndwXQdJOskUVH1O94EDmnXFct091XPn6TF0z2x/4KVnDno/WU\neE8m\r\n=iTso\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnBuiw9rS+d5+yRi05aTrN+Rt3PTL4XXj4m3zWZdp9DAIgd6Llb1o6Hw5P+lcnTPwZjDIODyn0IGkaFRB8iyxjcvI="}]},"_npmUser":{"name":"switch1983","email":"darren.op@cent.finance"},"directories":{},"maintainers":[{"name":"switch1983","email":"darren.op@cent.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cent.dex.sor-xdai_0.0.1_1611756348128_0.4498213643500737"},"_hasShrinkwrap":false},"0.0.2":{"name":"@centfinance/cent.dex.sor-xdai","version":"0.0.2","license":"GPL-3.0-only","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc","test":"nyc mocha -r ts-node/register test/*.spec.ts","coverage":"nyc report --reporter=text-lcov | coveralls"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"devDependencies":{"@ethersproject/wallet":"^5.0.7","@types/chai":"^4.2.10","@types/mocha":"^7.0.2","@types/node":"^14.0.20","chai":"^4.2.0","coveralls":"^3.0.9","dotenv":"^8.2.0","husky":"^4.2.1","mocha":"^7.1.0","nyc":"^15.0.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","ts-node":"^8.6.2","typescript":"^3.8.3"},"dependencies":{"@ethersproject/address":"^5.0.5","@ethersproject/constants":"^5.0.5","@ethersproject/contracts":"^5.0.5","@ethersproject/providers":"5.0.12","@ethersproject/solidity":"^5.0.5","@ethersproject/units":"^5.0.6","bignumber.js":"^9.0.0","isomorphic-fetch":"^2.2.1"},"description":"There are two types of swap available:","_id":"@centfinance/cent.dex.sor-xdai@0.0.2","dist":{"shasum":"963ca1c893061ae470cb43d34eff11c51a7106a0","integrity":"sha512-CZ6hDDWByZFBSvqzK/QYpvBx2fANxGPguAvzvgsurGW4c3LOOiTQYZG7xdJTxNkgZ/SOWeYro8EdHcNZrMaG7w==","tarball":"https://registry.npmjs.org/@centfinance/cent.dex.sor-xdai/-/cent.dex.sor-xdai-0.0.2.tgz","fileCount":30,"unpackedSize":151488,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgEzPrCRA9TVsSAnZWagAAsyMP/R/eVRuwJYwwsG+EdztJ\nvmNek4x4o+uOp2JIbTyNxTxZvnsgPTSk1dJ/E/ivHbRprlo0H6HWNA0wdcsn\nWvUMWYFME5mnEGM2DJaKOVS0gHmxIjPBCYm3dpxEFeRKXuKMa5BC7ecnwvrP\nKUMpbF+hsyWNAdZw8eA9wDfaHdUP8rDhM7HX82WkXhEHDr2vdnV4V1ApkH4O\nHGchMhNqqwIBXhSDvYP7vUHOfqOov8QtYR6903OL7NVLOZflxYwYXn9ejrWm\nHJprLjy5MehgEAk9IhmMOvaKrdrR0TChRj+3L1yeTbNcW9SCxcYYIji/LeNb\nAMBZMo+bh9JGCD5ZImz3pIXvRKByY6HyAXfdxnLDbyJNR72aJth1GK12Pxf1\nftfnDjDcYJWfTo//boTSggyUVe7ZYGZ12ErkaF8bbn55EEMLym8vsmNR3uSs\nfdxE//WpARbM6TNUliAv8OyUGAavISQso1paiPdfLRoNgtDxk3HkDO64BZ5+\nOuFLy+oDqogNXAZDnZ4d+HK7I+WhIH+biFhh4japa0zgQYuGNM6xFRjELmfY\nRPkQKYAX2/TSUwEaTKD+I8cRspdYSjvi4f93K3fYQdVHaI0fsLcas/j16cMl\nW1NwWuMmJQgQt6/Mb65TLNNZp30P+Tn+E2hM9RGfngnEr/6vMGIHWykB2zGZ\nY5O1\r\n=4kq8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDYPDFghJ2fiY3ChO5Uczd0lyIXInMsuV01RBiYv7DKjwIhAPt8ahLxJOtwJzu4fTffrmm7X467Nib+Q/Ciyx1rvT6f"}]},"_npmUser":{"name":"switch1983","email":"darren.op@cent.finance"},"directories":{},"maintainers":[{"name":"switch1983","email":"darren.op@cent.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cent.dex.sor-xdai_0.0.2_1611871211302_0.769497756140471"},"_hasShrinkwrap":false},"0.0.3":{"name":"@centfinance/cent.dex.sor-xdai","version":"0.0.3","license":"GPL-3.0-only","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prepublish":"tsc","test":"nyc mocha -r ts-node/register test/*.spec.ts","coverage":"nyc report --reporter=text-lcov | coveralls"},"husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"devDependencies":{"@ethersproject/wallet":"^5.0.7","@types/chai":"^4.2.10","@types/mocha":"^7.0.2","@types/node":"^14.0.20","chai":"^4.2.0","coveralls":"^3.0.9","dotenv":"^8.2.0","husky":"^4.2.1","mocha":"^7.1.0","nyc":"^15.0.0","prettier":"^1.19.1","pretty-quick":"^2.0.1","ts-node":"^8.6.2","typescript":"^3.8.3"},"dependencies":{"@ethersproject/address":"^5.0.5","@ethersproject/constants":"^5.0.5","@ethersproject/contracts":"^5.0.5","@ethersproject/providers":"5.0.12","@ethersproject/solidity":"^5.0.5","@ethersproject/units":"^5.0.6","bignumber.js":"^9.0.0","isomorphic-fetch":"^2.2.1"},"description":"There are two types of swap available:","_id":"@centfinance/cent.dex.sor-xdai@0.0.3","dist":{"shasum":"dd0509f0b1d0104d59ba9760636b2ca8ec8395ec","integrity":"sha512-XHfUIBQEmqqFjNAa8C2TRzVJ/T2J1YHqgDFUYOmdwhTowSDPTvohVG0tuzo3m75elMVpWAi9PCtiWDzg1neJLQ==","tarball":"https://registry.npmjs.org/@centfinance/cent.dex.sor-xdai/-/cent.dex.sor-xdai-0.0.3.tgz","fileCount":30,"unpackedSize":151488,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgHqtyCRA9TVsSAnZWagAAaBoP/1TfO1bXneUtd565IP8I\n67r5xl8VCzoUAxbXQ6LASulYh2C/bg6htMwUkZhjROCjTBLCEMPGSQ2YmXUa\nhUCMJ9EZRpT0IM0MnWswRCBazHSuAkjK2tljhYPO7Jbiw2ImLPUdt2P7mwWW\nRjFlL3I9bVVJ7saoUG7JKWcockx9MRlkyDI2aAw14LFlTgNDF5sZJ1iWQEh5\n1DY0AWw7oV4irV5KlgENb/1VDqlA4NkCSJ6KlFcmksr7m1UujndSerIEtioo\nYvYDtyl0hcJDErDVpiR2rFMUSTNyj7d7Za2Jq4wx503ae0LD6vm9xkLVziEi\nFPwnz3fZaBIjUsUJoXtoQbtwZBXVGBRbyWy91+8y49LVnW2o3is7IhOKerGz\nlhFY3iJOale9Aj/ului8Zemh7KtQwAuR3bgCURfk2PwGxEFp0cCd/Nzk0q9Y\n76IeqJZycqEa65SVEo6XSMVEQRZRzOl7qHsoqg4u0/c2grOx7afMIh+oCBh8\nE1tsfAjy5aRw1azPqPw1sPuJohYRCfGH80oaRmOWcFKhXbxBxTzsklSflid6\nDOnWzKBFeLu6zPkAvw0lirkevGRS9TasODtKp1RqI2goeemn3q4LSaHXfnTF\nBh15Ju9E8AGP+IOArnAU0u+SjVc1pZ2QK8dyT4mVFNDsnOY+fZ7DM5xsXe3C\nx+N9\r\n=fFys\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFxW+mpr2OrMyuILq5HjKKvSGqMjIP63yOYO+Es3k24zAiEAqw37dCcg+kc2ji/fkDUHgzMzKSdwfUlsRZokmI+k15k="}]},"_npmUser":{"name":"switch1983","email":"darren.op@cent.finance"},"directories":{},"maintainers":[{"name":"switch1983","email":"darren.op@cent.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cent.dex.sor-xdai_0.0.3_1612622705037_0.7339027915911644"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-27T14:05:47.895Z","0.0.1":"2021-01-27T14:05:48.236Z","modified":"2022-04-04T22:19:24.335Z","0.0.2":"2021-01-28T22:00:11.450Z","0.0.3":"2021-02-06T14:45:05.396Z"},"maintainers":[{"name":"switch1983","email":"darren.op@cent.finance"}],"description":"There are two types of swap available:","license":"GPL-3.0-only","readme":"<p align=\"center\">\n  <a href=\"https://circleci.com/gh/balancer-labs/balancer-sor\">\n    <img src=\"https://circleci.com/gh/balancer-labs/balancer-sor.svg?style=svg&circle-token=33636208d3161f79ff283b29c8dba9841bda8931\" />\n  </a>\n  <a href=\"https://coveralls.io/github/balancer-labs/balancer-sor\">\n    <img src=\"https://coveralls.io/repos/github/balancer-labs/balancer-sor/badge.svg?t=7avwwt\" />\n  </a>\n  <a href=\"https://www.gnu.org/licenses/gpl-3.0\">\n    <img src=\"https://img.shields.io/badge/License-GPLv3-green.svg\" />\n  </a>\n  <a href=\"https://www.npmjs.com/package/@balancer-labs/sor\">\n    <img src=\"https://img.shields.io/badge/npm-v0.2.4-blue.svg?style=flat-square\" />\n  </a>\n</p>\n\n<h1 align=center><code>Smart Order Router (SOR)</code></h1>\n\nSmart Order Router, or SOR, is an off-chain linear optimization of routing orders across pools for best price execution.\n\nSOR exists in the Bronze release as a way to aggregate liquidity across all Balancer pools. Future releases of Balancer will accomplish this on-chain and allow aggregate contract fillable liquidity.\n\nLiquidity aggregators are free to use the SOR npm package or create their own order routing across pools.\n\n[Read More](https://docs.balancer.finance/protocol/sor)\n\n## Overview Of Use And Example\n\nThere are two types of swap available:\n\n**swapExactIn** - i.e. You want to swap exactly 1 ETH as input and SOR will calculate X amount of BAL you receive in return.  \nor  \n**swapExactOut** - i.e. You want to receive exactly 1 BAL and SOR will calculate X amount of ETH you must input.\n\nThe SOR will return totalReturn/totalInput as well as a list swaps to achieve the total. Swaps can be through direct pools, i.e. A > POOL1 > B, or via a multihop pool, i.e. A > POOL1 > C > POOL2 > B. The swaps can be executed directly on-chain or with something like the [ExchangeProxy](https://github.com/balancer-labs/balancer-registry/blob/master/contracts/ExchangeProxy.sol).\n\nExample Output:\n\n```js\n// Following is output for 1USDC->WETH swapExactIn\n[\n    swaps,\n    amountOut,\n] = await SOR.getSwaps(....\n\n  console.log(\n      `USDC>WETH, SwapExactIn, 1USDC, Total WETH Return: ${amountOut.toString()}`\n  );\n  // USDC>WETH, SwapExactIn, 1USDC, Total WETH Return: 3090385829490120 - This is the total amount of WETH received for 1USDC\n  console.log(`Swaps: `);\n  console.log(swaps);\n\n  /*\n    This demonstrates a multihop swap going:\n    USDC -> BTC++ via pool 0x75286...\n    Then BTC++ -> WETH via pool 0xd4dbf...\n  */\n  [\n    // Multihop swap\n    [\n      // First sequence in swap\n      {\n        pool: '0x75286e183d923a5f52f52be205e358c5c9101b09',\n        tokenIn: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n        tokenOut: '0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd',\n        swapAmount: '1000000',\n        limitReturnAmount: '0',\n        maxPrice: '115792089237316195423570985008687907853269984665640564039457584007913129639935'\n       },\n      // Second sequence in swap\n      {\n        pool: '0xd4dbf96db2fdf8ed40296d8d104b371adf7dee12',\n        tokenIn: '0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd',\n        tokenOut: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n        swapAmount: '89403274570637',\n        limitReturnAmount: '0',\n        maxPrice:'115792089237316195423570985008687907853269984665640564039457584007913129639935'\n      }\n    ]\n  ]\n```\n\nThe file: [example-swapExactIn.ts](test/testScripts/example-swapExactIn.ts), shows full examples with comments for various swaps.\n\nTo Run:\n\nCreate a .env file in root dir with your infura provider key: `INFURA=your_key`\n\nInstall dependencies: `$ yarn install`\n\nRun example: `$ ts-node ./test/testScripts/example-swapExactIn.ts`\n","readmeFilename":"README.md"}