{"id":18263726,"url":"https://github.com/yearn/tokenized-strategy-foundry-mix","last_synced_at":"2025-04-06T10:10:31.939Z","repository":{"id":154455454,"uuid":"632103501","full_name":"yearn/tokenized-strategy-foundry-mix","owner":"yearn","description":"Create Yearn V3 \"Tokenized Strategies\" using Foundry","archived":false,"fork":false,"pushed_at":"2025-03-16T20:28:00.000Z","size":83,"stargazers_count":66,"open_issues_count":0,"forks_count":34,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T09:05:33.776Z","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":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T18:04:53.000Z","updated_at":"2025-03-16T20:28:04.000Z","dependencies_parsed_at":"2023-10-23T01:23:43.253Z","dependency_job_id":"1d321c2e-3f9b-464e-b321-e53da8bc65c8","html_url":"https://github.com/yearn/tokenized-strategy-foundry-mix","commit_stats":null,"previous_names":["yearn/tokenized-strategy-foundry-mix"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Ftokenized-strategy-foundry-mix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Ftokenized-strategy-foundry-mix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Ftokenized-strategy-foundry-mix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yearn%2Ftokenized-strategy-foundry-mix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yearn","download_url":"https://codeload.github.com/yearn/tokenized-strategy-foundry-mix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464220,"owners_count":20942970,"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:26.176Z","updated_at":"2025-04-06T10:10:31.896Z","avatar_url":"https://github.com/yearn.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tokenized Strategy Mix for Yearn V3 strategies\n\nThis repo will allow you to write, test and deploy V3 \"Tokenized Strategies\" using [Foundry](https://book.getfoundry.sh/).\n\nYou will only need to override the three functions in Strategy.sol of `_deployFunds`, `_freeFunds` and `_harvestAndReport`. With the option to also override `_tend`, `_tendTrigger`, `availableDepositLimit`, `availableWithdrawLimit` and `_emergencyWithdraw` if desired.\n\nFor a more complete overview of how the Tokenized Strategies work please visit the [TokenizedStrategy Repo](https://github.com/yearn/tokenized-strategy).\n\n## How to start\n\n### Requirements\n\n- First you will need to install [Foundry](https://book.getfoundry.sh/getting-started/installation).\nNOTE: If you are on a windows machine it is recommended to use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)\n- Install [Node.js](https://nodejs.org/en/download/package-manager/)\n\n### Clone this repository\n\n```sh\ngit clone --recursive https://github.com/yearn/tokenized-strategy-foundry-mix\n\ncd tokenized-strategy-foundry-mix\n\nyarn\n```\n\n### Set your environment Variables\n\nUse the `.env.example` template to create a `.env` file and store the environement variables. You will need to populate the `RPC_URL` for the desired network(s). RPC url can be obtained from various providers, including [Ankr](https://www.ankr.com/rpc/) (no sign-up required) and [Infura](https://infura.io/).\n\nUse .env file\n\n1. Make a copy of `.env.example`\n2. Add the value for `ETH_RPC_URL` and other example vars\n     NOTE: If you set up a global environment variable, that will take precedence.\n\n### Build the project\n\n```sh\nmake build\n```\n\nRun tests\n\n```sh\nmake test\n```\n\n## Strategy Writing\n\nFor a complete guide to creating a Tokenized Strategy please visit: https://docs.yearn.fi/developers/v3/strategy_writing_guide\n\nNOTE: Compiler defaults to 8.23 but it can be adjusted in the foundry toml.\n\n## Testing\n\nDue to the nature of the BaseStrategy utilizing an external contract for the majority of its logic, the default interface for any tokenized strategy will not allow proper testing of all functions. Testing of your Strategy should utilize the pre-built [IStrategyInterface](https://github.com/yearn/tokenized-strategy-foundry-mix/blob/master/src/interfaces/IStrategyInterface.sol) to cast any deployed strategy through for testing, as seen in the Setup example. You can add any external functions that you add for your specific strategy to this interface to be able to test all functions with one variable.\n\nExample:\n\n```solidity\nStrategy _strategy = new Strategy(asset, name);\nIStrategyInterface strategy =  IStrategyInterface(address(_strategy));\n```\n\nDue to the permissionless nature of the tokenized Strategies, all tests are written without integration with any meta vault funding it. While those tests can be added, all V3 vaults utilize the ERC-4626 standard for deposit/withdraw and accounting, so they can be plugged in easily to any number of different vaults with the same `asset.`\n\nTests run in fork environment, you need to complete the full installation and setup to be able to run these commands.\n\n```sh\nmake test\n```\n\nRun tests with traces (very useful)\n\n```sh\nmake trace\n```\n\nRun specific test contract (e.g. `test/StrategyOperation.t.sol`)\n\n```sh\nmake test-contract contract=StrategyOperationsTest\n```\n\nRun specific test contract with traces (e.g. `test/StrategyOperation.t.sol`)\n\n```sh\nmake trace-contract contract=StrategyOperationsTest\n```\n\nSee here for some tips on testing [`Testing Tips`](https://book.getfoundry.sh/forge/tests.html)\n\nWhen testing on chains other than mainnet you will need to make sure a valid `CHAIN_RPC_URL` for that chain is set in your .env. You will then need to simply adjust the variable that RPC_URL is set to in the Makefile to match your chain.\n\nTo update to a new API version of the TokenizeStrategy you will need to simply remove and reinstall the dependency.\n\n### Test Coverage\n\nRun the following command to generate a test coverage:\n\n```sh\nmake coverage\n```\n\nTo generate test coverage report in HTML, you need to have installed [`lcov`](https://github.com/linux-test-project/lcov) and run:\n\n```sh\nmake coverage-html\n```\n\nThe generated report will be in `coverage-report/index.html`.\n\n### Deployment\n\n#### Contract Verification\n\nOnce the Strategy is fully deployed and verified, you will need to verify the TokenizedStrategy functions. To do this, navigate to the /#code page on Etherscan.\n\n1. Click on the `More Options` drop-down menu\n2. Click \"is this a proxy?\"\n3. Click the \"Verify\" button\n4. Click \"Save\"\n\nThis should add all of the external `TokenizedStrategy` functions to the contract interface on Etherscan.\n\n## CI\n\nThis repo uses [GitHub Actions](.github/workflows) for CI. There are three workflows: lint, test and slither for static analysis.\n\nTo enable test workflow you need to add the `ETH_RPC_URL` secret to your repo. For more info see [GitHub Actions docs](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces#adding-secrets-for-a-repository).\n\nIf the slither finds some issues that you want to suppress, before the issue add comment: `//slither-disable-next-line DETECTOR_NAME`. For more info about detectors see [Slither docs](https://github.com/crytic/slither/wiki/Detector-Documentation).\n\n### Coverage\n\nIf you want to use [`coverage.yml`](.github/workflows/coverage.yml) workflow on other chains than mainnet, you need to add the additional `CHAIN_RPC_URL` secret.\n\nCoverage workflow will generate coverage summary and attach it to PR as a comment. To enable this feature you need to add the [`GH_TOKEN`](.github/workflows/coverage.yml#L53) secret to your Github repo. Token must have permission to \"Read and Write access to pull requests\". To generate token go to [Github settings page](https://github.com/settings/tokens?type=beta). For more info see [GitHub Access Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyearn%2Ftokenized-strategy-foundry-mix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyearn%2Ftokenized-strategy-foundry-mix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyearn%2Ftokenized-strategy-foundry-mix/lists"}