There is a problem with using yearn.finance though, with yearn.finance you are part of a shared pool of liquidity. This means smaller investments can’t take importunity of flash interest moments. Let’s go through an example;
Let’s say the DAI pool is currently at $50k and sitting at Fulcrum @ 8% APR. There is an opportunity at Aave @ 10% APR, but the maximum amount that can be invested @ Aave is $20k. The current yearn.finance pool implementation will not move the funds, since it calculates it is earning more APR at Fulcrum at $50k DAI, than it would if it moved the $50k to Aave, since this would decrease the Aave APR to 7.5%.
But if you were a solo investor, and you had $10k, you could take advantage of this opportunity. So the goal of this article is to walk you through deploying your own private version of yearn.finance so that you can take advantage of customized opportunities.
Now the process does require some technical knowledge, but I will try to explain as much as possible.
Step 1: head over to the github and fork or clone the following two repositories;
The first repo, iearn-finance is the web interface, it is built in React. After you have forked & cloned it to your local system (and having installed npm and nodejs), simply run the following commands;
We do need to update some configs, but we will get back to that after deploying our contracts.
The second repo is the itoken (+ytoken) mono repo.
If you as an investor are only interested in DAI, you only need to deploy yDAI (so simply deploy the contracts you are interested in). Now there are a few ways you can deploy it. If you are comfortable with truffle, my recommendation is with truffle build and truffle deploy, but to keep it simple, we will use remix.
So go over to remix and create a new file;
Click the + on remix (highlighted green below), and enter the name yDAI.sol
After compiling finishes, click on “Deploy and run transaction” (highlighted below in green).
Next, we need to set some deploy settings;
In the deploy pane, set the following;
- Environment = Injected Web3
- Contract = yDAI (the dropdown just above the Deploy button)
And simply click “Deploy”. This will ask you to sign the transaction via Metamask (or whichever web3 plugin you use), and give you an etherscan transaction id;
Take note of the contract address above, we will need it just now.
Next, you need to edit the webapp to talk to your newly created contract.
Open the project folder in your preferred IDE (or simply navigate to /iearn-finance/src/stores/store.jsx and edit in your preferred editor).
In stores.jsx you will see the following;
Remove the ones you aren’t interested in (if you only deployed yDAI, only keep DAI), and update the iEarnContract address to your newly created contract address (from when you deployed the contract above).
And then simply run the webapp by running;
This will open up the webapp in your browser at http://localhost:3000
And that’s it. Now you can interact with it locally and optimize your yield for your own investment size and stay in full control.
If you want to launch a competitor to yearn.finance, you can also follow all the above steps, you would simply need to host the website yourself :)