How to add new token mechanics
Last updated
Last updated
We might encounter cases where we need to add a token mechanic that is not at all available through the Basic editor. In such cases, we can add it through the advanced editor.
For example, suppose we want to add an expenditure of the treasury related to the number of users on the platform, to represent infrastructure costs. Letâs assume the treasury is selling tokens to cover this cost.
Since the Treasury agent is already in the simulation, we do not need to create a new one, simply add a new mechanic in which this agent participates. We need to create a new flow representing the action we want the treasury to take.
This new flow represents the treasury selling tokens to the market, so its Source is âTreasuryâ and its destination is the âMarketâ.
Next, we need to fill in the equation for the new token flow. The appropriate row in the equations table was created automatically with a default value of 0 when we added the new token flow in the previous section.
We want this selling flow to increase with the usage of the platform, since itâs meant to cover infrastructure costs.. We can do this by adding a multiplier on TDP_vp_1_growth_param to calculate the total infrastructure expenses. Letâs consider that we spend $0.01 USD for each dollar lent, which we will introduce as a new parameter, SP_vp_expense_operations. Additionally, since token flows are always defined as token units per time step, and the infrastructure expenses are in dollars per month, we need to multiply by the time step in months and divide by the token price or, in this case, an average of it.
Now, the system will look like this:
Note that the platform indicates that there is an error in the new equation we wrote. This is because we introduced a new static parameter (SP_vp_expense_operations) that we have not yet defined in the âInput Parameters'' section. We will do that next in order to fix this error.
We simply need to introduce a new static parameter for the parameter we defined in the equation, and give it a default value.
Remember that to let the user change a static parameter and test it, we will need to add it into the sidebar section.
Now we can go to the simulation preview and check whether the numbers make sense.
In this example, we see that there is a moment when the treasury runs out of tokens, meaning the protocol does not have enough tokens to pay the expenses we introduced.
There are two possibilities:
The simulation is well configured, indicating a problem with the treasury expenditure, which will run out of tokens quickly. This insight would mean we need to rethink the treasury expenditure.
The simulation is ill-formed: Here, we realize that spending 0.01 USD in infrastructure for each dollar exchanged makes no sense, and that we actually meant 0.0001 USD.
After applying the change, the simulation runs normally.
We can now confirm the impact on the economy by looking at the buying and selling pressure charts ("Treasury sales to cover infrastructure", highlighted in red in the chart below).
Alternatively, we could create a custom metric and graph to visualize it. We will do that next.
We can configure a report to provide a specific insight to the end user, or for internal consumption. This time, we will create a new graph for the report to understand treasury expenditure.
On the metrics screen, we introduce the flow that represents the token sale. We want to report this sale monthly, so we use the appropriate groupby function. Additionally, we need to represent the amount in USD, so we convert the tokens to USD.
Now that we have the metric ready, we can open the âResults Graph Configurationâ and create the new graph.
We add our newly created metric as the variable to plot.
And then we add it in the âResults Graphs Configurationâ
Finally, we are ready to âGo to results previewâ.
Once we verify the impact is as expected, we should add the newly created input parameter in the âSidebar Configurationâ to let the user test it, since by default, the input parameters created in the setup are not visible from the dashboard. In this case, we can add it into the âUser behaviorâ section.
With that, we will have completed a full iteration of the token economy.