This repository contains the Balancer Protocol V2 core smart contracts, including the Vault and standard Pools, along with their tests, configuration, and deployment information.
For high-level intructions of the included projects, see:
- Introducing Balancer V2: Generalized AMMs
- GMX Contracts
- GMX Technical Overview
- CoW Protocol Smart Contracts
This is a Yarn 2 monorepo, with the packages meant to be published in the pkg directory. Newly developed packages may not be published yet.
Active development occurs in this repository, which means some contracts in it might not be production-ready. Proceed with caution.
v2-deployments: addresses and ABIs of all Balancer V2 deployed contracts, for mainnet and various test networks.v2-interfaces: Solidity interfaces for all contracts.v2-vault: theVaultcontract and all core interfaces, includingIVaultand the Pool interfaces:IBasePool,IGeneralPoolandIMinimalSwapInfoPool.v2-pool-weighted: theWeightedPool,WeightedPool2TokensandLiquidityBootstrappingPoolcontracts, along with their associated factories.v2-pool-stable: theStablePoolandMetaStablePoolcontracts, along with their associated factories.v2-pool-linear: theAaveLinearPoolandERC4626LinearPoolcontracts, along with their associated factories.v2-pool-utils: Solidity utilities used to develop Pool contracts.v2-solidity-utils: miscellaneous Solidity helpers and utilities used in many different contracts.v2-standalone-utils: miscellaneous standalone utility contracts.v2-liquidity-mining: contracts that compose the liquidity mining (veBAL) system.v2-governance-scripts: contracts that execute complex governance actions.
Before any tests can be run, the repository needs to be prepared:
$ yarn # install all dependencies
$ yarn build # compile all contractsMost tests are standalone and simply require installation of dependencies and compilation. Some packages however have extra requirements. Notably, the deployments package must have access to network archive nodes in order to perform fork tests. For more details, head to its readme file.
In order to run all tests (including those with extra dependencies), run:
$ yarn test # run all testsTo instead run a single package's tests, run:
$ cd pkg/<package> # e.g. cd pkg/v2-vault
$ yarn testMost of the Solidity source code is licensed under the GNU General Public License Version 3 by Balancer Labs (GPL v3): see LICENSE.
- All files in the
openzeppelindirectory of thev2-solidity-utilspackage are based on the OpenZeppelin Contracts library, and as such are licensed under the MIT License: see LICENSE. - All sub-packages in the
perpetualsdirectory are based on GMX Contracts, and as such are licensed under the MIT License: see LICENSE. - The
LogExpMathcontract from thev2-solidity-utilspackage is licensed under the MIT License. - All other files, including tests and the
pvtdirectory are unlicensed.