{"id":26162489,"url":"https://github.com/balancer/cow-amm","last_synced_at":"2025-04-14T13:30:25.858Z","repository":{"id":251768383,"uuid":"816326923","full_name":"balancer/cow-amm","owner":"balancer","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-16T09:15:06.000Z","size":7386,"stargazers_count":8,"open_issues_count":3,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:38:53.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balancer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audits/Certora_Report_For_Balancer_v1.pdf","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-17T14:11:27.000Z","updated_at":"2025-02-21T20:15:42.000Z","dependencies_parsed_at":"2024-12-16T09:28:14.026Z","dependency_job_id":"a2761379-a05d-4f97-a236-a1f9d77a4b06","html_url":"https://github.com/balancer/cow-amm","commit_stats":null,"previous_names":["balancer/cow-amm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balancer%2Fcow-amm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balancer%2Fcow-amm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balancer%2Fcow-amm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balancer%2Fcow-amm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balancer","download_url":"https://codeload.github.com/balancer/cow-amm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248888520,"owners_count":21178073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-11T13:54:41.278Z","updated_at":"2025-04-14T13:30:25.808Z","avatar_url":"https://github.com/balancer.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=center\u003e\u003ccode\u003eBalancer CoW AMM\u003c/code\u003e\u003c/h1\u003e\n\n**Balancer CoW AMM** is an automated **portfolio manager**, **liquidity provider**, and **price sensor**, that allows swaps to be executed via the CoW Protocol.\n\nBalancer is based on an N-dimensional invariant surface which is a generalization of the constant product formula described by Vitalik Buterin and proven viable by the popular Uniswap dapp.\n\n## Development\n\nMost users will want to consume the ABI definitions for BPool, BCoWPool, BFactory and BCoWFactory.\n\nThis project follows the standard Foundry project structure. \n\n```\nyarn build   # build artifacts to `out/`\nyarn test    # run the tests\n```\n\n## Changes on BPool from [Balancer V1](https://github.com/balancer/balancer-core)\n- Migrated to Foundry project structure\n- Implementation of interfaces with Natspec documentation\n- Replaced `require(cond, 'STRING')` for `if(!cond) revert CustomError()`\n- Bumped Solidity version from `0.5.12` to `0.8.25` (required for transient storage)\n  - Added explicit `unchecked` blocks to `BNum` operations (to avoid Solidity overflow checks)\n- Deprecated `Record.balance` storage (in favour of `ERC20.balanceOf(address(this))`)\n- Deprecated `gulp` method (not needed since reading ERC20 balances)\n- Deprecated manageable pools:\n  - Deprecated `isPublicSwap` mechanism (for pools to be swapped before being finalized)\n  - Deprecated `rebind` method (in favour of `bind + unbind + bind`)\n  - Deprecated exit fee on `unbind` (since the pool is not supposed to have collected any fees)\n- Deprecated `BBaseToken` (in favour of OpenZeppelin `ERC20` implementation)\n- Deprecated `BColor` and `BBronze` (unused contracts)\n- Deprecated `Migrations` contract (not needed)\n- Added an `_afterFinalize` hook (to be called at the end of the finalize routine)\n- Implemented reentrancy locks using transient storage.\n- Deprecated `joinswap` and `exitswap` methods (avoid single-token math precision issues)\n\n## Features on BCoWPool (added via inheritance to BPool)\n- Immutably stores CoW Protocol's `SolutionSettler` and `VaultRelayer` addresses at deployment\n- Immutably stores Cow Protocol's a Domain Separator at deployment (to avoid replay attacks)\n- Immutably stores Cow Protocol's `GPv2Order.appData` to be allowed to swap\n- Gives infinite ERC20 approval to the CoW Protocol's `VaultRelayer` contract at finalization time.\n- Implements IERC1271 `isValidSignature` method to allow for validating intentions of swaps\n- Implements a `commit` method to avoid multiple swaps from conflicting with each other.\n  - This is stored in the same transient storage slot as reentrancy locks in order to prevent calls to swap/join functions within a settlement execution or vice versa.\n  - It's an error to override a commitment since that could be used to clear reentrancy locks. Commitments can only be cleared by ending a transaction.\n- Validates the `GPv2Order` requirements before allowing the swap\n\n## Features on BCoWFactory\n- Added a `logBCoWPool` to log the finalization of BCoWPool contracts, to be called by a child pool.\n\n## Creating a Pool\n- Create a new pool by calling the corresponding pool factory:\n  - `IBFactory.newBPool(name, symbol)` for regular Balancer `BPool`s\n  - `IBCoWFactory.newBPool(name, symbol)` for Balancer `BCoWPool`s, compatible with CoW Protocol\n    \u003e Being `name` and `symbol` strings with the desired name and symbol of the pool's ERC20 LP token\n- Give ERC20 allowance to the pool by calling `IERC20.approve(pool, amount)`\n- Bind tokens one by one by calling `IBPool.bind(token, amount, weight)`\n  - The amount represents the initial balance of the token in the pool (pulled from the caller's balance)\n  - The weight represents the intended distribution of value between the tokens in the pool\n- Modify the pool's swap fee by calling `IBPool.setSwapFee(fee)`\n- Finalize the pool by calling `IBPool.finalize()`\n\n# Deployments\nEthereum Mainnet:\n  - BCoWFactory: [0xf76c421bAb7df8548604E60deCCcE50477C10462](https://etherscan.io/address/0xf76c421bAb7df8548604E60deCCcE50477C10462)\n  - BCoWHelper: [0x3FF0041A614A9E6Bf392cbB961C97DA214E9CB31](https://etherscan.io/address/0x3FF0041A614A9E6Bf392cbB961C97DA214E9CB31)\n  - BCoWHelper with arbitrary amounts: [0x03362f847b4fabc12e1ce98b6b59f94401e4588e](https://etherscan.io/address/0x03362f847b4fabc12e1ce98b6b59f94401e4588e#code)\n\nEthereum Sepolia:\n  - BCoWFactory: [0x1E3D76AC2BB67a2D7e8395d3A624b30AA9056DF9](https://sepolia.etherscan.io/address/0x1E3D76AC2BB67a2D7e8395d3A624b30AA9056DF9)\n  - BCoWHelper: [0xf5CEd4769ce2c90dfE0084320a0abfB9d99FB91D](https://sepolia.etherscan.io/address/0xf5CEd4769ce2c90dfE0084320a0abfB9d99FB91D)\n  - BCoWPool: [0xE4aBfDa4E8c02fcAfC34981daFAeb426AA4186e6](https://sepolia.etherscan.io/address/0xE4aBfDa4E8c02fcAfC34981daFAeb426AA4186e6)\n\nGnosis Mainnet:\n  - BCoWFactory: [0x703Bd8115E6F21a37BB5Df97f78614ca72Ad7624](https://gnosisscan.io/address/0x703Bd8115E6F21a37BB5Df97f78614ca72Ad7624)\n  - BCoWHelper: [0x198B6F66dE03540a164ADCA4eC5db2789Fbd4751](https://gnosisscan.io/address/0x198B6F66dE03540a164ADCA4eC5db2789Fbd4751)\n  - BCoWHelper with arbitrary amounts: [0xdb2aeab529c035469e190310def9957ef0398ba8](https://gnosisscan.io/address/0xdb2aeab529c035469e190310def9957ef0398ba8)\n\nArbitrum One:\n  - BCowFactory with Pausable: [0xE0e2Ba143EE5268DA87D529949a2521115987302](https://arbiscan.io/address/0xe0e2ba143ee5268da87d529949a2521115987302)\n  - BCoWHelper with arbitrary amounts: [0xdb2aeab529c035469e190310def9957ef0398ba8](https://arbiscan.io/address/0xdb2aeab529c035469e190310def9957ef0398ba8#code)\n\nBase:\n  - BCowFactory with Pausable: [0x03362f847B4fAbC12e1Ce98b6b59F94401E4588e](https://basescan.org/address/0x03362f847b4fabc12e1ce98b6b59f94401e4588e)\n  - BCoWHelper with arbitrary amounts: [0x467665D4ae90e7A99c9C9AF785791058426d6eA0](https://basescan.org/address/0x467665d4ae90e7a99c9c9af785791058426d6ea0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalancer%2Fcow-amm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalancer%2Fcow-amm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalancer%2Fcow-amm/lists"}