the secret farming project that is gonna change the world (Part 2)
Phew, that was quite a ride!
We opened the streaming farms to the public on June 11th, 2021, and had to run to increase the max. flow rate faster than any of us could’ve expected. Three days later, they were all maxed out.
So hear us out: While we provided the initial and most basic information about the Minerva Streaming Farms in our previous post, we deliberately left out all the details that make this a revolutionary way of farming. What is life without a dash of suspense, after all? (If you haven’t read the previous post yet, please head over there before you dive deep into this one)
Minerva Streaming Farms: The architecture.
For the first iteration of streaming farms, we used an architecture that is custom-made to demonstrate the use case and experiment with integrations, while also rewarding our dear community members with $MIVA.
As you can see, every farm is independent and therefore every farm has its own MIVA reward pool and its own NFT contract (forming a collection). The NFT contract and the farm are linked in order to determine the correct stream rate for every NFT owner.
There are, of course, some limitations to that architecture if you want to use different reward tokens, or custom APR values over time, or a NFT collection for multiple farms. For more on what we have in mind, jump down to the outlook.
…down the rabbit hole.
There exists a farm contract for every incentivized LP-token. E.g. the streaming farm contract for the MIVA-WXDAI pair is deployed at 0xa2eac044fe1e004cAaC4E8C4164a39F4Cc522b6f. Each streaming farm is configured to accept a specific LP-token. The MIVA-WXDAI streaming farm thus accepts the MIVA-WXDAI LP token, which has the token address 0x19b8eB5FfC078A0b50274c08d955900BD0007E32.
Since the LP-tokens are dumb ERC20 tokens, they can’t just be sent to the farm contract, instead, a farmer (staker) needs to call the method stake() of the streaming farm contract, which uses the method transferFrom() of ERC20 in order to fetch the given amount of tokens. For that to succeed, the staker first needs to approve that operation. And all this is handled by the farm Dapp.
The actual staking transaction (example) does the following:
- Transfer the given amount of LP-tokens from the staker to the streaming farm contract (in this case the amount is 800 tokens).
- Determine the reference value of the stake denominated in MIVA:
<reference value> = <stake LP amount> * <current amount of MIVA in the liquidity pool> / <current total supply of lp tokens>This is, in essence, the same formula as used by the Uniswap V2 protocol to determine the price of assets (source).
- Mint a farm position NFT (FP-NFT) representing the position to the staker with the following immutable data associated:
- Amount of LP-tokens staked;
- Reference value;
- Creation timestamp;
- Open a reward stream to the staker, a.k.a. initial FP-NFT owner, with an initial flowrate corresponding to the Level 1 rewards (
<reference value> * <reward coefficient>).
Once enough time has passed for a position to have reached the next reward level, the current owner of the FP-NFT can adjust (increase) the reward flowrate accordingly with a simple transaction, conveniently done via the farm Dapp.
Whenever an FP-NFT is transferred to a new owner, the attached reward stream automatically changes to the new owner. This happens regardless of the wallet or Dapp used for the transfer. In the context of this transaction, the flowrate is also adjusted to the max. allowed by the current Level, in case it wasn’t already. E.g. if the current owner hasn’t leveled it up yet, even with it being possible, a transfer will trigger the levelling-up.
The current owner on an FP-NFT can, at any time, close the position by invoking the
_unstake()` method of the farm - of course, also supported by the farm Dapp. This will trigger the following operations:
- The reward stream stops;
- The FP-NFT is burned;
- The amount of LP-tokens deposited by the initial staker and represented by the position is transferred from the farm to the last FP-NFT owner.
So, in essence, the Farm Position NFTs represent ownership of both the LP-tokens and, thereby, a share of the asset pair in the Liquidity Pool it represents, plus the reward stream attached to it. Because of the progressive increase of the reward stream, such FP-NFTs may also become more valuable over time. Note, however, that the reward-ratio is fixed to the reference value determined at the time of initial staking.
The progressing of the price along the way is another parameter which continually influences the effective reward of a position: A rising MIVA price makes pre-existing NFTs more valuable, while a falling MIVA price may render existing positions less attractive, potentially to the point of making it more lucrative to close and reopen a position in order to get a new, more favorable reference value. This should, however, be carefully calculated, as it may or may not be outweighed by the temporary reduction of relative flowrate.
Settings of current Streaming Farms.
In order to guarantee a minimum runtime of the streams, despite the limited budget for overall rewards to be distributed, each farm has a limit to the aggregated flowrate. This limit is enforced by not allowing new staking positions to be created, which may result in the limit to be exceeded down the line (at any reward level).
The limit for the MIVA/WXDAI farm was set such that the farm would distribute 1M MIVA as reward over 2 years, if saturated early on… And as it turned out, the saturation happened much faster than we expected (yesss) which would have resulted in the target budget of 1M to be slightly exceeded in the 2 years time.
This would have been the case, if all staking positions initially created remain in place for the whole time period, thus all staking positions being at Level 6 by the second year.
On June 18th, 2021, the farms were reopened once more with an increased MIVA distribution over the 2 years period.
Once the farms are “Maxed Out”, the only way to get the FP-NFTs is through purchase on the secondary market. Eporio is, at the moment, the best place to go for shopping.
Nevertheless, if someone stops farming and destroys the FP-NFT, the corresponding farm opens up again, until it is filled by the same person or someone else with new LP-tokens.
Due to the overwhelming success of streaming farms, we’ve started working on a more general version of them. It’s more of a protocol to be developed, which enables everyone to generate their own streaming farms. So, think of it as the first version of a decentralized securities generator, with full on-chain data and graphics.
Besides that, there is still a lot to unbundle regarding the actual value of the current FP-NFTs, and this should make it simpler for the secondary market to have a clear evaluation of the offered and asked price.
Last but not least, we are, of course, considering having streaming farms on other chains supported by the Superfluid Protocol too. Currently, aside from xDai Chain, there’s also Polygon with a prospect of seeing it on ramped up Ethereum L2-solutions.
And that’s all folks, the big inside-look into our Streaming Farms is done, time to backtrack from the rabbit hole and get back to surface in time for tea.
We’re happy to be sharing this with you, as we’re very proud of our (not so secret anymore) Farming Project and what it can accomplish, so, hopefully, this post leaves you all with the same energy-buzz and enthusiasm as it does to us!
What is the Minerva Wallet
Minerva is a digital wallet for moneys and self-sovereign identities. It allows you to maintain full control over your funds, credentials and data. Supporting a variety of networks and comporting a very stress-free and user-friendly interface, it aims to lift commons to eye level with all companies. Right now, we are eagerly improving our services bit by bit and moving ahead with each passing day.
We are also thrilled to see our community growing with every new step taken. Our mascot is an owl, a purple one, mind you, and the cutest in all of cryptospace. One might say we are biased, but so far, everyone has agreed to it!
The $MIVA SuperToken
The $MIVA SuperToken is a streamable utility token, the first of its kind, which breaks grounds for innovation and originality. Providing a wide range of benefits for Minerva Wallet users, its distribution relies heavily on user engagement and participation, nurturing a truly organic growth of the community.
Join our owlish community!
Big eyes, fun and wisdom — the whole package.