{"_id":"@aurora-balancer-labs/v2-pool-weighted","name":"@aurora-balancer-labs/v2-pool-weighted","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.1":{"name":"@aurora-balancer-labs/v2-pool-weighted","version":"2.0.1","description":"Balancer V2 Weighted Pools","license":"GPL-3.0-only","homepage":"","repository":{"type":"git","url":"","directory":"pkg/pool-weighted"},"scripts":{"build":"yarn compile","compile":"hardhat compile && rm -rf artifacts/build-info","compile:watch":"nodemon --ext sol --exec yarn compile","lint":"yarn lint:solidity && yarn lint:typescript","lint:solidity":"solhint 'contracts/**/*.sol'","lint:typescript":"eslint . --ext .ts --ignore-path ../../.eslintignore  --max-warnings 0","test":"yarn compile && mocha --extension ts --require hardhat/register --require @aurora-balancer-labs/v2-common/setupTests --recursive","test:fast":"yarn compile && mocha --extension ts --require hardhat/register --require @aurora-balancer-labs/v2-common/setupTests --recursive --parallel --exit","test:watch":"nodemon --ext js,ts --watch test --watch lib --exec 'clear && yarn test --no-compile'"},"devDependencies":{"@aurora-balancer-labs/balancer-js":"workspace:*","@aurora-balancer-labs/v2-common":"workspace:*","@aurora-balancer-labs/v2-helpers":"workspace:*","@aurora-balancer-labs/v2-interfaces":"workspace:*","@aurora-balancer-labs/v2-pool-utils":"workspace:*","@aurora-balancer-labs/v2-solidity-utils":"workspace:*","@nomiclabs/hardhat-ethers":"^2.0.1","@nomiclabs/hardhat-waffle":"^2.0.0","@types/chai":"^4.2.12","@types/lodash":"^4.14.161","@types/mocha":"^8.0.3","@types/node":"^14.6.0","@typescript-eslint/eslint-plugin":"^4.1.1","@typescript-eslint/parser":"^4.1.1","chai":"^4.2.0","decimal.js":"^10.2.1","eslint":"^7.9.0","eslint-plugin-mocha-no-only":"^1.1.1","eslint-plugin-prettier":"^3.1.4","ethereum-waffle":"^3.0.2","ethers":"^5.4.1","hardhat":"^2.8.3","lodash.frompairs":"^4.0.1","lodash.pick":"^4.4.0","lodash.range":"^3.2.0","lodash.times":"^4.3.2","lodash.zip":"^4.2.0","mocha":"^8.2.1","nodemon":"^2.0.4","prettier":"^2.1.2","prettier-plugin-solidity":"v1.0.0-alpha.59","solhint":"^3.2.0","solhint-plugin-prettier":"^0.0.4","ts-node":"^8.10.2","typescript":"^4.0.2"},"_id":"@aurora-balancer-labs/v2-pool-weighted@2.0.1","_nodeVersion":"14.15.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-cTuhQpXD85qffh55L+I2NbPKMvve0V41SslA9JK9xRg9pDP/H4XUefKwX7Ri34NmDzbCK6Wcegk/45JEr4FkeQ==","shasum":"e7856607afe91495d616142c885185b6aed48b95","tarball":"https://registry.npmjs.org/@aurora-balancer-labs/v2-pool-weighted/-/v2-pool-weighted-2.0.1.tgz","fileCount":17,"unpackedSize":169924,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDWZlErRIahZXmctx8hxrBv8tXMlq2HxxffcLcKLetWdQIgPXocoGssBtakA6liekfU18nT5vR54irP+Y9JQnqoY8Q="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJivGqLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqzCg//Vn0WmCzSG4DAAKGiwes1Zfi3MuEdZ5qeKwxbtmnApT1iiLZS\r\nBSvPYMMXr/mBqr91daSRNpS7eE+mbAPRv2lbcwNmWQ8Lun9stFrXO/zm4+ii\r\nbapSSsQSBG6xIy0c1mkmfw6VOY1RDkalDfmz+0Jifx6EOZGchHmJvZuzbHC5\r\ncwmFwTPt+b+jMcZd/fLIQqeI5qSZxjpn036AXOADQii6KhtlqLihp3xGg4AR\r\nvf4gVYieXj88ioJakOaQjppKOEsk1Zx0vGu/7unLEjH7xvX0BCePPJ+y9wnH\r\noPHgubW9ymEh/P3vOiulIIk/D91oB0N0KuPzAlwMJ44s1wWqbkF0lBptPiGf\r\nWdsN+1KwuSuKrDUUd8133ghP/PXfA0HrVH1xHK6/Au9HsXalybV925SYCa9C\r\nuqcQ9rSifENE4rxSHpa7FsyU1m1Qixa0bat5oH3M5vx2V9vsdSGmO9UywtKI\r\noXa1usPk6Zv6aGsglpq2+pNi3AtwPB9JS3UIr08oR+1iL6F28aL94cnnNC7e\r\nokQldHRf8oWdEMRPzMfVR7yuAXI8s7bOAU7i8fLrwHFre8KLpkkoWUGV+IEY\r\nQ/X6Zp3fe0i60UC6X2t+rIr+/Ze0nSNJltMaZtPniZ5gFORNMOMUA0OARGX7\r\nQO5U2EENRosCvvgk7dmZOghIHdhU+T3fW5k=\r\n=K1pv\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"philipptaratuta","email":"philipp.t@blaize.tech"},"directories":{},"maintainers":[{"name":"philipptaratuta","email":"philipp.t@blaize.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/v2-pool-weighted_2.0.1_1656515210889_0.1160893499053921"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-29T15:06:50.845Z","2.0.1":"2022-06-29T15:06:51.087Z","modified":"2022-06-29T15:06:51.299Z"},"maintainers":[{"name":"philipptaratuta","email":"philipp.t@blaize.tech"}],"description":"Balancer V2 Weighted Pools","repository":{"type":"git","url":"","directory":"pkg/pool-weighted"},"license":"GPL-3.0-only","readme":"# <img src=\"../../logo.svg\" alt=\"Balancer\" height=\"128px\">\n\n# Balancer V2 Weighted Pools\n\n[![NPM Package](https://img.shields.io/npm/v/@balancer-labs/v2-pool-weighted.svg)](https://www.npmjs.org/package/@balancer-labs/v2-pool-weighted)\n\nThis package contains the source code for Balancer V2 Weighted Pools, that is, Pools that swap tokens by enforcing a Constant Weighted Product invariant.\n\nThe pool currently in existence is [`WeightedPool`](./contracts/WeightedPool.sol) (basic twenty token version).\n\nThe [`smart`](./contracts/smart) directory contains a number of 'smart' variants, which automatically update some of their attributes to support more complex use cases. Examples are [`LiquidityBootstrappingPool`](./contracts/smart/LiquidityBootstrappingPool.sol) for auction-like mechanisms, and [`ManagedPool`](./contracts/smart/ManagedPool.sol) for managed portfolios.\n\n| :warning: | Managed Pools are still undergoing development and may contain bugs and/or change significantly. |\n| --------- | :-------------------------------------------------------------------------------------------------- |\n\nAnother useful contract is [`WeightedMath`](./contracts/WeightedMath.sol), which implements the low level calculations required for swaps, joins, exits and price calculations.\n\n## Overview\n\n### Installation\n\n```console\n$ npm install @aurora-balancer-labs/v2-pool-weighted\n```\n\n### Usage\n\nThis package can be used in multiple ways, including interacting with already deployed Pools, performing local testing, or even creating new Pool types that also use the Constant Weighted Product invariant.\n\nTo get the address of deployed contracts in both mainnet and various test networks, see [`v2-deployments`](../deployments).\n\nSample Weighted Pool that computes weights dynamically on every swap, join and exit:\n\n```solidity\npragma solidity ^0.7.0;\n\nimport '@aurora-balancer-labs/v2-pool-weighted/contracts/BaseWeightedPool.sol';\n\ncontract DynamicWeightedPool is BaseWeightedPool {\n    uint256 private immutable _creationTime;\n\n    constructor() {\n        _creationTime = block.timestamp;\n    }\n\n    function _getNormalizedWeightsAndMaxWeightIndex() internal view override returns (uint256[] memory) {\n        uint256[] memory weights = new uint256[](2);\n\n        // Change weights from 50-50 to 30-70 one month after deployment\n        if (block.timestamp < (_creationTime + 1 month)) {\n          weights[0] = 0.5e18;\n          weights[1] = 0.5e18;\n        } else {\n          weights[0] = 0.3e18;\n          weights[1] = 0.7e18;\n        }\n\n        return (weights, 1);\n    }\n\n    ...\n}\n\n```\n\n## Licensing\n\n[GNU General Public License Version 3 (GPL v3)](../../LICENSE).\n","readmeFilename":"README.md"}