{"id":18263791,"url":"https://github.com/yearn/zaps","last_synced_at":"2025-10-11T17:11:19.947Z","repository":{"id":38774732,"uuid":"338037792","full_name":"yearn/zaps","owner":"yearn","description":"Repository for v2 Vaults Zaps","archived":false,"fork":false,"pushed_at":"2022-12-29T03:33:50.000Z","size":142,"stargazers_count":7,"open_issues_count":0,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-20T19:07:25.796Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yearn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-11T13:32:40.000Z","updated_at":"2024-12-12T13:58:31.000Z","dependencies_parsed_at":"2023-01-31T08:01:22.060Z","dependency_job_id":null,"html_url":"https://github.com/yearn/zaps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"yearn/brownie-strategy-mix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fzaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fzaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fzaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Fzaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yearn","download_url":"https://codeload.github.com/yearn/zaps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247246368,"owners_count":20907783,"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":"2024-11-05T11:12:38.332Z","updated_at":"2025-10-11T17:11:14.902Z","avatar_url":"https://github.com/yearn.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yearn Zaps\n\n## What you'll find here\n\n- Useful Contracts to interact with the Yearn Protocol Smart Contracts ([`contracts/`](contracts/))\n\n- Interfaces for some of the most used DeFi protocols on ethereum mainnet. ([`interfaces/`](`interfaces/`))\n\n- Sample test suite that runs on mainnet fork. ([`tests/`](tests))\n\nThis mix is configured for use with [Ganache](https://github.com/trufflesuite/ganache-cli) on a [forked mainnet](https://eth-brownie.readthedocs.io/en/stable/network-management.html#using-a-forked-development-network).\n\n## How does it work for the User\n\nLet's say Alice holds 100 DAI and wants to start earning yield % on them.\n\nFor this Alice needs to `DAI.approve(zap.address, 100)`.\n\nThen Alice will call the Zap Contract e.g `Zap.deposit(100)`.\n\nVault will then transfer 100 DAI from Alice to itself, and mint Alice the corresponding shares.\n\nAlice can then redeem those shares using `Vault.withdrawAll()` for the corresponding DAI balance (exchanged at `Vault.pricePerShare()`).\n\n## Installation and Setup\n\n1. [Install Brownie](https://eth-brownie.readthedocs.io/en/stable/install.html) \u0026 [Ganache-CLI](https://github.com/trufflesuite/ganache-cli), if you haven't already.\n\n2. Sign up for [Infura](https://infura.io/) and generate an API key. Store it in the `WEB3_INFURA_PROJECT_ID` environment variable.\n\n```bash\nexport WEB3_INFURA_PROJECT_ID=YourProjectID\n```\n\n3. Sign up for [Etherscan](www.etherscan.io) and generate an API key. This is required for fetching source codes of the mainnet contracts we will be interacting with. Store the API key in the `ETHERSCAN_TOKEN` environment variable.\n\n```bash\nexport ETHERSCAN_TOKEN=YourApiToken\n```\n\n4. Download the mix.\n\n```bash\nbrownie bake yearn-strategy\n```\n\n## Basic Use\n\nTODO: steps for Common Zap usage\n\n## Testing\n\nTo run the tests:\n\n```\nbrownie test\n```\n\nThe example tests provided in this mix start by deploying and approving your [`Zap.sol`](contracts/) contract. This ensures that the loan executes successfully without any custom logic. Once you have built your own logic, you should edit [`tests/`](tests/) and remove this initial funding logic.\n\nSee the [Brownie documentation](https://eth-brownie.readthedocs.io/en/stable/tests-pytest-intro.html) for more detailed information on testing your project.\n\n## Debugging Failed Transactions\n\nUse the `--interactive` flag to open a console immediately after each failing test:\n\n```\nbrownie test --interactive\n```\n\nWithin the console, transaction data is available in the [`history`](https://eth-brownie.readthedocs.io/en/stable/api-network.html#txhistory) container:\n\n```python\n\u003e\u003e\u003e history\n[\u003cTransaction '0x50f41e2a3c3f44e5d57ae294a8f872f7b97de0cb79b2a4f43cf9f2b6bac61fb4'\u003e,\n \u003cTransaction '0xb05a87885790b579982983e7079d811c1e269b2c678d99ecb0a3a5104a666138'\u003e]\n```\n\nExamine the [`TransactionReceipt`](https://eth-brownie.readthedocs.io/en/stable/api-network.html#transactionreceipt) for the failed test to determine what went wrong. For example, to view a traceback:\n\n```python\n\u003e\u003e\u003e tx = history[-1]\n\u003e\u003e\u003e tx.traceback()\n```\n\nTo view a tree map of how the transaction executed:\n\n```python\n\u003e\u003e\u003e tx.call_trace()\n```\n\nSee the [Brownie documentation](https://eth-brownie.readthedocs.io/en/stable/core-transactions.html) for more detailed information on debugging failed transactions.\n\n\u003c!--\n## Deployment\n\nWhen you are finished testing and ready to deploy to the mainnet:\n\n1. [Import a keystore](https://eth-brownie.readthedocs.io/en/stable/account-management.html#importing-from-a-private-key) into Brownie for the account you wish to deploy from.\n2. Edit [`scripts/deployment.py`](scripts/deployment.py) and add your keystore ID according to the comments.\n3. Run the deployment script on the mainnet using the following command:\n\n```bash\n$ brownie run deployment --network mainnet\n```\n\nYou will be prompted to enter your keystore password, and then the contract will be deployed.\n--\u003e\n\n## Known issues\n\n### No access to archive state errors\n\nIf you are using Ganache to fork a network, then you may have issues with the blockchain archive state every 30 minutes. This is due to your node provider (i.e. Infura) only allowing free users access to 30 minutes of archive state. To solve this, upgrade to a paid plan, or simply restart your ganache instance and redeploy your contracts.\n\n# Resources\n\n- Yearn [Discord channel](https://discord.com/invite/6PNv2nF/)\n- Brownie [Gitter channel](https://gitter.im/eth-brownie/community)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyearn%2Fzaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyearn%2Fzaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyearn%2Fzaps/lists"}