{"_id":"@centfinance/cent.dex.sor-celo","_rev":"2-d94291391873a1d10c95b0db86b53c6b","name":"@centfinance/cent.dex.sor-celo","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@centfinance/cent.dex.sor-celo","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-celo@0.0.1","dist":{"shasum":"79b79dc2d385b13a27948e1d54f9e659179aef10","integrity":"sha512-56lacuDFp03s2NeCulh5TqqUh+aLIK5824Rx+fQRXaznaK9nTi60NbHySPyOM7Sqe677vxNdQcnpgtic65Vvow==","tarball":"https://registry.npmjs.org/@centfinance/cent.dex.sor-celo/-/cent.dex.sor-celo-0.0.1.tgz","fileCount":30,"unpackedSize":146602,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgoESgCRA9TVsSAnZWagAA0ScP/ibYOnm8oHJ+AimdEvjm\nfofJu2eabTMcy0ZIECtaU6lmzzXwxC2kiQoYXt2UtRwgmHjaOFhDcuy8GrUN\ntAOzVTmvT0yUAqsj/Go85rY5jceic2LIKKA4wYpBhaJ+wvFIzXc0sAUPteju\nwVQXp6zmrxsTRAqt7IIoA9onv5kpFmfqZ+PZd3aH0e6fQvbVwmM3RBeWza70\ng/5LLAANIELeWUwf3YF36gMixKC9+YQeH+AKzetnXTSU6NwMN/ksw9HmhdNO\nlPBK8fZk28gJFWvAqgKvryGDORXqMhxqZ8skukfC2NdXRGd+EZnLtxCYVTvk\nB2JEy9+KzfOjajfkFAZd/lp9xiru+L6LzlPq7yvVOcxZ6ZShaIx1OWvsMXeZ\n9hOxmI77wDn0zkSHgD267z+oQu68bAWW57JDabtKddSkD0B6qmL5L0fOkaCf\n6ncQxh2MOIFT5Ue9UEWn1MoGQYlrDjxb9f02d3/6GxsarG/ISKgQhA1kYPh2\nzCRYFcqDMUEURvepzsgTItw70j054e4fohooTfEaz4wir1MKXjnmliILiarL\nb/QNEOah3ojJnB8qkHcZ5ChkjDHuwo/y/oRdYzBhPfcwKW1yINFNbqklcD6m\nJDb1hSAo7mOSdrNGuR5JA+QRaF4MwVmiWzb2oj0iwXmv+NLtbEi9qgqrFmVM\npoqK\r\n=KflZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG38+gOSgVCd5RK0ViDea3ehxeBFJfYJ3Xi++xVM3cL6AiALTAs/m8KCLp2OpWym1DqdW6nuc64SfKpGc4BUqNZdRA=="}]},"_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-celo_0.0.1_1621116063722_0.9640011592413495"},"_hasShrinkwrap":false},"0.0.2":{"name":"@centfinance/cent.dex.sor-celo","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-celo@0.0.2","dist":{"shasum":"d80a926a05e143299233aadc9c074fd7f9d5d4f0","integrity":"sha512-EL9xsdkZ3u0PlBJN2YBhxPKaTI7VQSSXUncjh/XLed6gGlrDiMxv8F/o7I1862UdRrMf6CwA3sti3uhZ4G8T7g==","tarball":"https://registry.npmjs.org/@centfinance/cent.dex.sor-celo/-/cent.dex.sor-celo-0.0.2.tgz","fileCount":30,"unpackedSize":147338,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgpXG8CRA9TVsSAnZWagAAJ5oQAIqPed2W+oLJdPnLe3Kz\nXBHUTPbT+x5EV5ybR3ptyZ6MQDtBsAxxQ2CUTop7b3jNPj1+EvyKvich23zF\nMyteKxPEV3sBJyZgPZ5QGruvCCnhxBiUy9AxB7gfQ1+twM8Kg/TerciQMYjj\nlcDKJlTv5fdBul5iDDDtKJAyr1jJThMCwE8OkIFGBpLAzkbSDRQuy4ECjEib\nhYQSGIqvm2tXXqi136+0WxoWKs1CHUHlvzZ+5SqGW4r8LRuOQnAphs5T25vA\nDEQcvwKVZeSfgi4HJy/acaUflCTdaT2TP08D63bKyRVbacnlW73Rsy5QzdA+\neIz1waG5Im6Tg/UEDjauhAmj8zFOajeaaiwgBXLr3u1LaC4QUQ86q9WG5KWZ\nI8CsduYUTGDtCR4Uk1ABRKVFd2BwJa5E4p7g/PpPu4vHlsk2lB8vx5gnv59B\nb8A+1rgjHty0Uw1gH3P0rTq2claiIajYv9gFEaRqeUUx1cda7lvwQpXxxCHG\nU3s/ZJjyaI8ZO1+5f4UEsSFV81HxxQOFXySFdw8MCw3bU7LP8A5GfKi/8Jdg\nZ5f/bObBjCEo1hJYp7Si6s1Ibq7twMizY2BdXzZBQcsJryFESgP+HPDtUoZ7\nfm8uHK3QRH+S9QDu17qR6lDo/6Wx6JvOph1HZkDUE68xo95v5Z4mnvFia4AX\nd2IX\r\n=zfQV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxxLnL0Uerqux2sXswvzc+QuK+Kv+haMUk0rP9R6n9hgIgFm8S+JZYPcFzUNNrPoIjqMDeSjcMrDdiHDFKnAWzeWI="}]},"_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-celo_0.0.2_1621455292376_0.12479453245624939"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-15T22:01:03.406Z","0.0.1":"2021-05-15T22:01:03.855Z","modified":"2022-04-04T22:19:24.154Z","0.0.2":"2021-05-19T20:14:52.550Z"},"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"}