{"id":13759834,"url":"https://github.com/gnosis/gp-v2-contracts","last_synced_at":"2025-05-10T10:30:29.908Z","repository":{"id":40655924,"uuid":"295515802","full_name":"gnosis/gp-v2-contracts","owner":"gnosis","description":"Smart contracts for the Gnosis Protocol v2","archived":true,"fork":false,"pushed_at":"2022-04-27T14:29:54.000Z","size":4857,"stargazers_count":159,"open_issues_count":0,"forks_count":45,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-12-22T18:04:44.537Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gnosis.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":null,"security":null,"support":null}},"created_at":"2020-09-14T19:18:39.000Z","updated_at":"2024-09-07T22:42:59.000Z","dependencies_parsed_at":"2022-07-17T08:46:35.850Z","dependency_job_id":null,"html_url":"https://github.com/gnosis/gp-v2-contracts","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnosis%2Fgp-v2-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnosis%2Fgp-v2-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnosis%2Fgp-v2-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnosis%2Fgp-v2-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnosis","download_url":"https://codeload.github.com/gnosis/gp-v2-contracts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253400853,"owners_count":21902560,"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":["hacktoberfest"],"created_at":"2024-08-03T13:00:59.841Z","updated_at":"2025-05-10T10:30:29.525Z","avatar_url":"https://github.com/gnosis.png","language":"TypeScript","funding_links":[],"categories":["dApps directory"],"sub_categories":["Smart Contract Templates"],"readme":"**:warning: The team that worked on this project has spun out of Gnosis and continues development on a forked repo (01-04-2022) which is available here \u003chttps://github.com/cowprotocol/contracts\u003e**\n\n# Gnosis Protocol V2\n\nThis repository contains the Solidity smart contract code for the Gnosis Protocol version 2.\nFor more documentation on how the protocol works on a smart contract level, see the [documentation pages](docs/index.md).\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\nContracts deployment (including contract verification) is run automatically with GitHub Actions. The deployment process is triggered manually.\nMaintainers of this repository can deploy a new version of the contract in the \"Actions\" tab, \"Deploy GPv2 contracts\", \"Run workflow\". The target branch can be selected before running.\nA successful workflow results in a new PR asking to merge the deployment artifacts into the main branch.\n\nContracts can also be deployed and verified manually as follows.\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\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 [![Coverage Status](https://coveralls.io/repos/github/gnosis/gp-v2-contracts/badge.svg?branch=main)](https://coveralls.io/github/gnosis/gp-v2-contracts?branch=main)\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### Solver Authentication\n\nThis repo contains scripts to manage the list of authenticated solvers in all networks the contract has been deployed.\n\nThe scripts are called with:\n\n```sh\nyarn solvers command [arg ...]\n```\n\nHere is a list of available commands.\nThe commands flagged with [*] require the private key of the authentication contract owner to be available to the script, for example by exporting it with `export PK=\u003cprivate key\u003e`.\n\n1. `add $ADDRESS` [*]. Adds the address to the list of registered solvers.\n2. `remove $ADDRESS` [*]. Removes the address from the list of registered solvers.\n3. `check $ADDRESS`. Checks if the given address is in the list of registered solvers.\n\nFor example, adding the address `0x0000000000000000000000000000000000000042` to the solver list:\n\n```sh\nexport PK=\u003cprivate key\u003e\nyarn solvers add 0x0000000000000000000000000000000000000042\n```\n\n### Fee Withdrawals\n\nScript to withdraw all balances of the Settlement contract. Allows to specify what minimum value the contract must have for a token to be considered (breadcrumbs might not be worth the gas costs) and how much remaining value should be left in the contract (e.g. to feed token buffers).\n\nIf no token list is passed in all traded token balances will be fetched from chain (can take a long time...)\n\n```sh\nexport PK=\u003cprivate key\u003e\nyarn hardhat withdraw --receiver 0x6C2999B6B1fAD608ECEA71B926D68Ee6c62BeEf8 --min-value 10000 --leftover 500 0x038a68ff68c393373ec894015816e33ad41bd564 0x913d8adf7ce6986a8cbfee5a54725d9eea4f0729\n```\n\n### Decoding Settlement CallData\n\nThis project exposes some handy scripts for parsing settlement calldata into human readable format.\n\nThe `decode` script can be used in two ways:\n\n1. By specifying the transaction hash of an existing settlement transaction `--txhash 0x...`\n\n```sh\nnpx hardhat decode --txhash 0xc12e5bc2ef9c116932301495738d555ea1d658977dacd6c7989a6d77125a17d2 --network mainnet\n```\n\n2. When no `txhash` is specified, by reading the calldata from stdin (`\u003c calldata.txt`). If stdin is a terminal, the user is prompted to paste the calldata into the terminal.\n\n```sh\n\u003e npx hardhat decode --network mainnet\n# Paste in the calldata to decode\n```\n\nNote that you will be expected to have your `INFURA_KEY` exported to your environment variables.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnosis%2Fgp-v2-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnosis%2Fgp-v2-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnosis%2Fgp-v2-contracts/lists"}