This repo contains smart contracts & unit tests for ETH Brussels Hackathon "Shitcoin Dozer Game Contract" using Foundry.
Base : 0x9d71865290cca388D427807C971fe7f6C364f5B4 Arbi : 0x254aEC4487b08A53c32De73f234574246f1A0052 Scroll : 0x9Db954a49B6Bf304ACc4B5D76c723c1cC9C7E073 Rootstock : 0x9DB954a49b6bf304aCc4B5D76C723C1cC9C7E073 APE Chain : 0x9Db954a49B6Bf304ACc4B5D76c723c1cC9C7E073 Zircuit : 0x9Db954a49B6Bf304ACc4B5D76c723c1cC9C7E073
- First you will need to install Foundry. NOTE: If you are on a windows machine it is recommended to use WSL
- Install Node.js
git clone --recursive https://github.com/yearn/tokenized-strategy-foundry-mix
cd tokenized-strategy-foundry-mix
yarnUse 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 (no sign-up required) and Infura.
Use .env file
- Make a copy of
.env.example - Add the value for
ETH_RPC_URLand other example vars NOTE: If you set up a global environment variable, that will take precedence.
make buildRun tests
make testExample:
Strategy _strategy = new Strategy(asset, name);
IStrategyInterface strategy = IStrategyInterface(address(_strategy));Due 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.
Tests run in fork environment, you need to complete the full installation and setup to be able to run these commands.
make testRun tests with traces (very useful)
make traceRun specific test contract (e.g. test/StrategyOperation.t.sol)
make test-contract contract=StrategyOperationsTestRun specific test contract with traces (e.g. test/StrategyOperation.t.sol)
make trace-contract contract=StrategyOperationsTestSee here for some tips on testing Testing Tips
When 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.
To update to a new API version of the TokenizeStrategy you will need to simply remove and reinstall the dependency.
Once 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.
- Click on the
More Optionsdrop-down menu - Click "is this a proxy?"
- Click the "Verify" button
- Click "Save"
This should add all of the external TokenizedStrategy functions to the contract interface on Etherscan.
This repo uses GitHub Actions for CI. There are three workflows: lint, test and slither for static analysis.
To enable test workflow you need to add the ETH_RPC_URL secret to your repo. For more info see GitHub Actions docs.
If 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.