{"id":25015193,"url":"https://github.com/cowprotocol/contracts","last_synced_at":"2025-04-11T23:17:25.792Z","repository":{"id":37013915,"uuid":"475887809","full_name":"cowprotocol/contracts","owner":"cowprotocol","description":"Smart contracts for the Gnosis Protocol v2","archived":false,"fork":false,"pushed_at":"2025-04-08T12:06:15.000Z","size":4864,"stargazers_count":133,"open_issues_count":15,"forks_count":39,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-11T23:17:13.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cowprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audits/GnosisProtocolV2May2021.pdf","citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-30T13:19:22.000Z","updated_at":"2025-04-09T13:42:47.000Z","dependencies_parsed_at":"2024-01-12T14:14:42.112Z","dependency_job_id":"e1182fa6-7b18-4ab9-b89b-382beb2fec9e","html_url":"https://github.com/cowprotocol/contracts","commit_stats":{"total_commits":774,"total_committers":16,"mean_commits":48.375,"dds":0.7105943152454781,"last_synced_commit":"7efd5b43fbf46fe40bac9e6de1b6bab05d27c20b"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowprotocol%2Fcontracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowprotocol%2Fcontracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowprotocol%2Fcontracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cowprotocol%2Fcontracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cowprotocol","download_url":"https://codeload.github.com/cowprotocol/contracts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492885,"owners_count":21113163,"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-02-05T08:18:14.404Z","updated_at":"2025-04-11T23:17:25.770Z","avatar_url":"https://github.com/cowprotocol.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]  \n\u003e This repository is in the process of being migrated to the [Foundry](https://getfoundry.sh) Ethereum application development environment. Developers wishing to integrate and/or develop on the CoW Protocol smart contracts with hardhat should refer to branch [`v1`](https://github.com/cowprotocol/contracts/tree/v1).\n\n# CoW Protocol\n\nThis repository contains the Solidity smart contract code for the **CoW Protocol** (formerly known as **Gnosis Protocol**).\n\nExtensive [documentation](https://docs.cow.fi/cow-protocol/reference/contracts/core) is available detailing how the protocol works on a smart contract level.\n\n## Getting Started\n\n### Building the Project\n\n```sh\nyarn\nyarn build\n```\n\n### Running Tests\n\n```sh\nyarn test\n```\n\nThe tests can be run in \"debug mode\" as follows:\n\n```sh\nDEBUG=* yarn test\n```\n\n### Gas Reporter\n\nGas consumption can be reported by setting the `REPORT_GAS` flag when running tests as\n\n```sh\nREPORT_GAS=1 yarn test\n```\n\n### Benchmarking\n\nThis repository additionally includes tools for gas benchmarking and tracing.\n\nIn order to run a gas benchmark on a whole bunch of settlement scenarios:\n\n```sh\nyarn bench\n```\n\nThese gas benchmarks can be compared against any other git reference and will default to the merge-base if omitted:\n\n```sh\nyarn bench:compare [\u003cref\u003e]\n```\n\nIn order to get a detailed trace of a settlement to identify how much gas is being spent where:\n\n```sh\nyarn bench:trace\n```\n\n## Deployment\n\n### Deploying Contracts\n\nChoose the network and gas price in wei for the deployment.\nAfter replacing these values, run:\n\n```sh\nNETWORK='rinkeby'\nGAS_PRICE_WEI='1000000000'\nyarn deploy --network $NETWORK --gasprice $GAS_PRICE_WEI\n```\n\nNew files containing details of this deployment will be created in the `deployment` folder.\nThese files should be committed to this repository.\n\n### Verify Deployed Contracts\n\n#### Etherscan\n\nFor verifying all deployed contracts:\n\n```sh\nexport ETHERSCAN_API_KEY=\u003cYour Key\u003e\nyarn verify:etherscan --network $NETWORK\n```\n\nSingle contracts can be verified as well, but the constructor arguments must be explicitly given to the command.\nA common example is the vault relayer contract, which is not automatically verified with the command above since it is only deployed indirectly during initialization. This contract can be manually verified with:\n\n```sh\nnpx hardhat verify --network $NETWORK 0xC92E8bdf79f0507f65a392b0ab4667716BFE0110  0xBA12222222228d8Ba445958a75a0704d566BF2C8\n```\n\nThe first address is the vault relayer address, the second is the deployment input (usually, the Balancer vault).\n\n#### Tenderly\n\nFor verifying all deployed contracts:\n\n```sh\nyarn verify:tenderly --network $NETWORK\n```\n\nFor a single contract, named `GPv2Contract` and located at address `0xFeDbc87123caF3925145e1bD1Be844c03b36722f` in the example:\n\n```sh\nnpx hardhat tenderly:verify --network $NETWORK GPv2Contract=0xFeDbc87123caF3925145e1bD1Be844c03b36722f\n```\n\n## Deployed Contract Addresses\n\nThis package additionally contains a `networks.json` file at the root with the address of each deployed contract as well the hash of the Ethereum transaction used to create the contract.\n\n## Test coverage\n\nTest coverage can be checked with the command\n\n```sh\nyarn coverage\n```\n\nA summary of coverage results are printed out to console. More detailed information is presented in the generated file `coverage/index.html`.\n\n## Known issues\n\nIf a user creates an order with:\n- zero sell amount\n- zero buy amount\n- partially fillable set to false\n\nthen this order could be executed an arbitrary amount of times instead of just a single time.\nThis means that any solver could drain the fee amount from the user until not enough funds are available anymore.\n\nWe recommend to never sign orders of this form and, if developing a contract that creates orders on behalf of other users, make sure at a contract level that such orders cannot be created.\n\n## Transfer Ownership\n\nThere is a dedicated script to change the owner of the authenticator proxy.\n\nThe following parameters can be set:\n\n```sh\nexport ETH_RPC_URL='https://rpc.url.example.com'\nexport NEW_OWNER=0x1111111111111111111111111111111111111111\nexport NEW_MANAGER=0x2222222222222222222222222222222222222222\n```\n\nTo test run the script from a specific owner (sender):\n\n```sh\nforge script script/TransferOwnership.s.sol:TransferOwnership --rpc-url \"$ETH_RPC_URL\" --sender 0xcA771eda0c70aA7d053aB1B25004559B918FE662\n```\n\nTo actually execute the transaction:\n\n```sh\nforge script script/TransferOwnership.s.sol:TransferOwnership --rpc-url \"$ETH_RPC_URL\" --private-key 0x0000000000000000000000000000000000000000000000000000000000000001 --broadcast --slow\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcowprotocol%2Fcontracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcowprotocol%2Fcontracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcowprotocol%2Fcontracts/lists"}