Masternode Yield Farming as a DAOSYS Usecase: Part 2
- Mini tutorial on the DAOSYS python simulator
- Provide projected LP returns from our simulation
- Masternode Yield Farming projections using modelled Syscoin rewards returns derived from 400 investment nodes (discussed in Part 1)
- Introduction
In this article we present the DAOSYS python simulator which is a tool that can be used alongside DAOSYS as a design tool to simulate decentralized finance (DeFi) activity. Not only is this tool useful applicable to DAOSYS, it can be used as a general purpose tool to simulate DEX activity for anyone wishing to setup their own liquidity pool (LP) and wish to stress test their ideas prior to development. This can be used as a powerful design tool to explore the limitations of an DeFi project idea prior to committing valuable resources on development costs (ie, Devs and Project Managers). Here, we demonstrate how we use the simulator to for our Masternode Yield Farming usecase of DAOSYS.
2. Birds Eye View
To setup our Masternode yield farm we deployed two users each representing the collective activity of two types of users such as Masternode yield deployment, and general organic use. A simulation done in two main steps: (a) setup; and (b) simulation. The setup phase is where agents (ie, tokens, liquidity pools, and users) are initialized, new tokens are minted and initial deposits are made. The simulation phase is where batch instruction sets are constructed, and the queue containing those instruction sets are generated, which is sent to the event executor to conduct the simulation; see Fig. 1 for illustration. To construct both of the phases, we use what’s called a batch instruction set.
3. Batch Instruction Set
Batch instruction sets comprise of a sequence of actions bound together in a batch which gets repeated N times to simulate typical real-world transactional behaviour in DeFi. These transactions made by users on tokens are called actions. Actions that have no dependencies on other actions accept events as input, whereas actions that have dependencies accept other actions as inputs are called action chains. Events can either accept scalar values indicating time and token deltas between events, or model output of time and token deltas. These models are univariate time series that are developed independently by users of the DAOSYS system by whatever tools they choose. We will go through a simple walkthrough to expound on this; see Fig 2 for illustration.
4. DAOSYS Python Tutorial
Here we walk through a mini tutorial on how to utilize the DAOSYS python simulator on a simple setup. This setup will include one user (ie, deployer), and two tokens (i.e., SYS
and DIA
) funding one liquidity pool. To start we must initialize all agents involved in this experimental simulation.
We create Mint
events for each of our TokenAgent
objects (ie, SYS
, DIA
, and SYS_DIA_LP
). To start, these mint events are agnostic until we tie them to an action, along with the associated user to create MintAction
objects.
These mint actions are then fed into an action batch, which is a batch instruction set, as explained above.
To ensure the setup batch was properly programmed, we inspect this batch for review. This concludes the setup phase of our demonstration.
Next, we generate some simple token and time delta models, which get pushed into a ModelQueue
object. Our token model is a simple Gaussian random variable, and our time token model is a Negative Binomial random variable; see Fig 3 for outcomes. As long as the input models are univariate processes, any model can be implemented, which demonstrates the flexibility of this tool for general use by the DeFi community.
See below for the distributions of our input models.
We create our agnostic simulation events using the model inputs provided above. These simulation events can also accept scalar values; for instance, if we want our time events to be equidistance, we would input the scalar value 86,400 (seconds) instead of our ModelQueue
object.
These events are fed as inputs into various actions (eg. DepositAction
), as also outlined in Fig. 2.
Once these actions are setup, we can program an ActionBatch
object, which is a sequence of DeFi instructions that get repeated N number of times to constitute the main portion of our simulation setup.
We inspect our action_batch
to ensure that our instructions make sense in accordance to our design intentions. Hence, this concludes the simulation phase of our demonstration.
Up till this point we have programmed two batches: (a) setup_batch
; and (b) action_batch
, which is the minimum requirement. There is no limit as to how many setup and action batches that can be implemented. Naturally, the more complex the design, the more batches of instruction sets. Next, we create an EventQueue
and add our setup_batch
and action_batch.
Finally, we run our simulation by feeding our EventQueue
object into the EventExecutor.
To ensure that our simulation went smoothly, we can inspect the action logs which include the time stamp, user, action, deltas and tokens involved in each of the individual simulated transactions.
To analyze the outcomes, we can pull the state series from each of our TokenAgent
objects (i.e., SYS
, DIA
, and SYS_DIA_LP
); below we show how it is done on theSYS
TokenAgent
object. Using the state series, we can pull the principle, balance and their associated time stamps, which are all python lists that can be utilized for analysis.
Using the data pulled from our state series, we plot the outcomes for each of the three tokens in our mini simulation tutorial; see Fig 4. For the demo code of this tutorial, please refer to the following Jupyter notebook in our DAOSYS Github repos.
5. Masternode Yield Farming Projections
In the example above, we ran a simple mini tutorial on how to use the DAOSYS python simulator. Here we expand our application to Masternode yield farming. The Masternode yield farming simulation is a bit more involved which includes two users: one to handle regular Masternode deposits, and another to simulate the aggregate of all swaps in the SYS_DAI_LP
liquidity pool. Also, we feed the aggregate of our five-year tokenomics model resulting from our 400 Masternodes (as covered in Part 1 of this discussion) so we can get a better idea of what to expect over the course of five years to perform the cost benefit analysis of this endeavor.
In Part 1 of this discussion, we calculated DAOSYS returns at 8% APY on Masternode contributions only. In Part 2 of this discussion we run a more realistic DAOSYS simulation to include organic activity on the LP as well. In Fig 5 (below) we provide the distribution of the outcomes of our token deposit model for both token deposits and time deltas. We assumed a gamma distribution for the token deposits with mean expectation of 4,000 SYS
per day, and a negative binomial distribution for the time deltas between deposits.
Using our DAOSYS simulator we constructed two batch sets of instructions to derive our five-year projections. The first batchset simulated the automated Syscoin Masternode contributions which we made a regular daily intervals (ie, every 86,000 seconds). The second batchset simulated the organic contributions of users to the liquidity pool at irregular intervals, which was modelled as a Negative Binomial random process; see Fig 6 for timeline illustration.
Using a procedure similar to steps outlined in last section, we ran our DAOSYS simulation of our Masternode yield farm and observed outcomes, as detailed in the following Tables 1–3. For the demo code of this simulation, please refer to the following Jupyter notebook in our DAOSYS Github repos.
6. Summary
In this article we took a deeper dive into our DAOSYS python simulator in the form of a mini tutorial. We also went into detail into the concept behind our batch instruction set which constitutes as the fundamental building block of our simulator. These batch instruction sets are fed into a queue which are automatically ordered in time by the simulator prior to execution. Logs of each transaction are kept which can be later pulled and analyzed to ensure correctness and also for debugging purposes.
For our simulation, we assumed a deployment of 400 new Masternodes which was analyzed over a five-year period starting Jan 2023. Our Syscoin price projections were based on Monte Carlo simulations using an ARIMA(1,1,1) which were fed into a logarithmic growth curve. The priced range had an aprior assumption of between $0.25 and $25 USD. To model organic usage, we assumed an expected net daily contribution of ~4,000 SYS to the liquidity pool.
When considering both Masternode contributions and organic usage, under these assumptions, we are predicting that our liquidity pool will have a market cap of anywhere between $51M to $488M USD, with an expectation of $304M USD by Dec 2027. Using the DAOSYS simulator, not only have we demonstrated the business value of what Masternode yield farming can do, but have demonstrated how this tool can be utilized as a planning tool for the DeFi community in general.
For Jupyter notebooks of tutorial and simulation, see here and here; for follow-up questions on using simulator, please reach out to imoore@syscoin.org.