USTC Re-Peg: Ziggy (Final)

Proposer : Duncan Day (@wrapped_dday)
Author : Duncan Day

0. Disclaimers and Declared Biases
Duncan manages the Onyx validator with PFC as a white-label service provider. Duncan does not have any formal affiliation with Terraform Labs, or other major organizations like TerraCVita.

Onyx has investments in the LUNC, LUNA, OSMO, ETH, STRD, and various other ecosystems on behalf of its delegates.

Duncan does not have any personal investments, but is paid on a performance-basis for investment management through a private fund called Lotus.

0a. Previous Discussions
Please read the previous discussions to gather full context on this proposal.

#1. Modify Luna Exchange Rate with Novel Fee Variable: apply a fee to usdr or other whitelisted denom exchange rates to provide an incentive for arbitrage.

#2. Ziggurat: apply the incentive for arbitrage on a “penny-by-penny” / “soft-peg” basis, in order to reach the penultimate goal of re-pegging USTC.

#3. Exchange Rate Modifier (ERM): apply the arbitrage incentive using a class called ERM, or “exchange rate modifier,” and apply the Greeks – quantities that measure price sensitivity of a derivative to a change in an underlying parameter – to guard this method from spiraling out of control.

#4. Pendulum: apply the arbitrage incentive as a premium or discount, “swinging” the incentives up or down in price to determine guard rails parameters.

1. Summary
This proposal describes an actionable framework for the LUNC Community to re-peg USTC from a code level, a consensus level (both technical and social), and guidelines to do so. While this proposal is a signaling proposal, actionable plans outlined here are enforceable through the Terra Community Trust guidelines. The end goal is to recover the value lost in the May 2022 “de-peg” of SDT from the IMF SDR, which USTC was most affected by, while streamlining LUNC burn processes.

Results of Voting
This proposal is a signaling proposal, meaning that there are no immediate, technical consequences for voting either way – a Yes or No will not change anything in the code. Failure to meet quorum or a No with Veto will still burn the deposit.

Yes = The community will enact the Ziggy proposal to the extent that they are capable of, including, but not limited to: financing teams, contributing work (paid or unpaid), altering the proposal for communal benefit, or other relevant tasks.

No = The community will not enact or produce work for the Ziggy proposal.

No with Veto = The community will not enact or produce work for the Ziggy proposal, and the depositors’ LUNC will be burned.

2. Motivation
If Terra stablecoins like USTC are not stable, the ability for the LUNC blockchain (Terra Classic) to generate meaningful revenue is extremely limited. Profitability is limited to complex AMM strategies and, primarily, arbitrage. Arbitrage is the simultaneous purchase and sale of equivalent assets or of the same asset in multiple markets in order to exploit a temporary discrepancy in prices. This proposal aims to expedite the process slightly using data-driven parameters across any market servicing Terra assets.

Terra stablecoins can be thought of like an option instead of a stablecoin when it is off-peg. We retain optionality even when stablecoins are stable, meaning we have a choice of where to allocate that money. When it is de-pegged, we are presented with less choices, as many consumer businesses, for example, will not accept a payment that changes value dynamically.

Without stability, we cannot truly benefit from volatility.

2a. Defining the ERM
Therefore, the class ExchangeRateModifier, or ERM, is proposed as a technical, open-source solution for Terra’s community to build on. A class is a blueprint for creating objects (or particular data structures), which provide initial values for state (variables or attributes that are “members” of that blueprint) and implementations of the behavior (functions or methods that are also considered members). More on Classes: Classes (OOP) | Brilliant Math & Science Wiki

The ERM class is outlined in the pseudo-code below:

class ERM {} // base class
struct Conditionals {} // when should the ERM turn off?
var = guard<type Rail>; // guards for the ERM with different "types" of Rails
enum Rail { _RAIL, 
            deltaTime,
            delta, vega, theta, gamma, rho, 
            volga, vanna, charm,
            lambda, epsilon, vomma, vera, zomma, ultima
          } // list of Guard Rails available; Rails can be added or removed
bool = ModifierActive; // is the ERM "on"?
float = taxRate; // what is the tax rate?
uint = SoftPeg(high, low); // what is the soft-peg calculated (high and low)?
uint = ModifierRange(uint high, uint low); // what is the range applied to the soft-peg (up/down)?
uint = ImmediateModifier; // how much should we immediately modify the soft-peg?
uint = ModifierBlockDuration(int blocks); // how many blocks is the ERM "on" for?

In this class, we define the ERM with certain properties. Our var guard<type Guard> defines a “guard rail” that can define the algorithm’s parameters.

2b. Using the ERM – The Greeks
The ERM can be upgraded or modified. It is an open-source, high-level model designed to bolster the robustness of the Terra stablecoin mechanism.

The ERM functions similar to a game’s Update() method, where every “tick” (frame) refreshes the game state. Normally, this is Time.deltaTime, which we measure through timestamping. Our alternative to measuring timeframes is to use theta, or time-to-expiry. We define a certain number of blocks under ModifierBlockDuration(int blocks) which can allow us to expire this incentive modifier after a certain block period. Note that this makes a notable difference for block-based MEV when contrasting it with deltaTime; the expiry can occur during a block with deltaTime.

The other Greeks listed are suggestions for Guard Rails (broad definitions):
delta : amount that one asset changes in price
vega : price volatility
gamma : how much a one-asset derivative changes in price (eg an AMM pair LP or LSD)
rho : how much interest rates (eg staking yield) affect price

The other Greeks are defined as second- or third-order derivatives. In actuality, any novel Guard Rail can be designed; a user may propose a Guard Rail with a unique name/ID such as Attacker and then define how that Guard Rail is used in the protocol.

2c. Using the ERM – Creating a Soft Peg
The ERM determines a SoftPeg by pulling the last-aggregated exchange rate given in the Vote Procedure. This means that the exchange rates are not altered between the Prevote and the Vote, only after it is completed and before Ballot Rewards are distributed. In essence, this pushes the margin-of-error for exchange rates slightly higher across validators. However, this is still gated by RewardBand which will punish validators and their delegates who submit outside of the range with no rewards.

For example, if the last-reported aggregate exchange rate for usdr is 1000usdr, then the ERM determines this as a “soft-peg.” The ERM then determines the ModifierRange(uint high, uint low) by filtering the SoftPeg rate through an operator function – for example, SoftPeg + 500usdr and SoftPeg - 500usdr. This defines SoftPeg(uint high, uint low).

Then, there is an immediate modifier applied to the soft peg that is within the ModifierRange. A simple heuristic to use is (ModifierRange(high) - ModifierRange(low)) / ModifierBlockDuration. If the ModifierBlockDuration is 50 blocks (roughly 10 Oracle cycles), and the ModifierRange(total) is 1000usdr (500 + 500), the resultant is 1000usdr / 10, or 100usdr immediately applied to the exchange rates.

This creates some interesting – and dangerous – scenarios where the ERM can re-apply Modifiers. This is why the Guard Rails are put on. A struct of ERM Conditionals define how and when this Terra algorithm component stops. For example:

if exchange rate >= SoftPeg(high, low) while ModifierActive == true,
THEN ModifierActive == false;

In essence, this says if the exchange rate reaches the SoftPeg limits while the ERM is on, turn it off – we don’t want to keep reapplying incentives. This allows the market to “catch up” to an exchange rate, and we can determine the “cooldown” of such a mechanism in another way algorithmically.

3. Proposal
The proposal outlines an action plan that the community can act on and modify according to preference.

3a. Obtain Developer Consensus
There is a small group of individuals who act as “validators for code,” a.k.a. the developers. The only alternative to Developer Consensus is to create a new repository and obtain Validator Consensus to accept that repository.

Failure to reach Developer Consensus renders the proposal null and void.

Due Date - ideally, before March. (1 month)

3b. Obtain Cross-Market Consensus
The core hurdle is ensuring that participating markets are on-board with this idea. This includes any market that services Terra assets on the native level. Tokens that are included:

  • Wrapped versions, synthetics, and liquid-staking derivatives tracking LUNC, including but not limited to: wLUNA, xLUNA, stLUNAC, ampLUNC, wUST, weUST, whLUNA, KRTC, wKRT, etc.
  • DEX markets that service the above assets and have a governance token, including but not limited to: UNI, AAVE, FRAX, CRV, CVX, LDO, ASTROC, OSMO, etc.
  • CEX markets that service the above assets and do not yet run a validator node. CEX markets must run a validator node as part of this proposal in order to corroborate their price submissions as an oracle service. They may not use external oracle service providers as exchange rates are serviced directly through the oracle.

By not obtaining Cross-Market Consensus, all actions taken by the LUNC blockchain validators and delegates through parameter change voting (such as TaxPolicy or RewardPolicy) can affect external markets positively or negatively. The Community, as outlined in the Terra Community Trust, have a fiduciary responsibility to assets in the Community Pool.

The Community also has an implicit fiduciary responsibility to the markets they have affected to-date, i.e., all markets that have been affected by a first-, second-, or tertiary-degree exposure to Terra assets. For example, proposals that negatively affect investments in wrapped tokens like wLUNA, as they are directly linked in price to LUNC, means that they can be held liable under relevant local jurisdictions.*

It is suggested that The Community uses a solution like Snapshot to obtain sentiment before asking other markets to enact governance processes, as it costs money to do so.

Failure to obtain sufficient Cross-Market Consensus, as determined through majority vote in each market, renders this proposal null and void.

Due Date - May 27th, 2024 as an absolute deadline.

*(To provide further examples: negatively affecting wLUNA affects Coinbase investors as well as UniSwap DEX users; the reverse is also true. Committing actions via the Community Pool exposes the committer to laws relevant to how member countries of LUNC approach relevant actions separately. There are 22 member countries participating in TerraSDR.)

3c. Test and Implement the ERM
The ERM requires a mainnet go-live approach, but it can be partially simulated on testnets. The Community may incentivize testnet simulations for quantative analysts (“quants”) to determine the best course of action. It is suggested that The Community utilize community pool funds to incentivize these facets of development.

Ultimately, the ERM cannot go live unless Cross-Market Consensus is obtained. If other markets do not want to participate, it is suggested that other markets, including LUNC, offer to purchase their distressed assets at face-value to continue participating. They can, again, offer to purchase these using funds in the community pool.

When satisfactory data has been collected, the ERM should go live on mainnet. This will, in real-time, affect all markets that have USTC, LUNC, other Terra stables like KRTC, wrapped equivalents like wLUNA, and synthetics tracking LUNC price like xLUNA; therefore, The Community should be prepared to shoulder ramifications of such a proposal.

Failure to Test and Implement the ERM renders this proposal null and void.

Due Date: May 27th, 2024 as an absolute deadline.

4. Pros and Cons
In simple terms, the Pros boil down to designing a more efficient system for LUNC and USTC that can burn more than the tax rate can, create a smoother environment for dApps and its users, and ultimately reach the penultimate goal of re-pegging USTC. The Cons for this proposal is that it is costly to make now and over time, and so, if The Community is not interested in expenditures that developers or contributors request for Ziggy, or if they do not have the means (capital or resources) to enact parts of the proposal, then the proposal has failed by way of default.

4a. Pros
Re-enabling the algorithmic token methodology without new minting of coins
Opening the potential of burning using the ERM instead of taxes (“built-in taxation”), increasing the rate of burns (demurrage) significantly
Enabling burns (demurrage) of LUNC and USTC across all markets that participate in Cross-Market Consensus of this proposal
Strengthening and streamlining governance across protocols and networks under a common goal
Obtaining thorough on-chain data regarding to AFT behaviors in the context of the derivatives market (both simple and complex)

4b. Cons
Inability to enact parts of the proposal without additional capital or consensus
Initial costly overhead to develop a solution on top of USTC, which may or may not work
Cost to maintain and refine data and usage of data initially high; requires improvement from community contributors

5. Conclusion and Notes
By reneging Terra Stablecoins like USTC, the community reneges one of its most potentially methods of making money: algorithmic foreign exchange trading and remittance. The reason that these opportunities exist for LUNC in the first place is due to the algorithmic currency creation. It is a challenging problem from a design perspective, and opting for any amount of collateral on-chain above 0 reduces the potentiality; it is simply more prudent to use a different chain for that purpose. Therefore, it is the Proposer’s opinion that LUNC continues to pursue a robust design of the algorithmic system, which Ziggy harkens back to.

Obtaining Developer Consensus either requires asking the developers to implement this on the base layer (L1). It can be done on a separate layer (L2) but is not ideal, or even possible, for reasons associated with latency. The other solution is to create another repository that attempts to tackle this problem and asking validators to run that version.

Obtaining Cross-Market Consensus requires that LUNC obtains consensus from other markets. Every action that the Community takes that affects LUNC price affects investors on all chains, some more than others. Using an algorithmic solution as proposed introduces vectors that may not be forecasted in this document. Additionally, LUNC must obtain consensus with CEXs like Binance through running a validator on-chain so that they can prove they are not manipulating internal prices against Terra’s. If this particular step is not taken with CEXs, LUNC risks destroying what has been built through the risks associated with direct oracle manipulation.

Finally, like any software, this must be tested and then sent into the field. This cannot stay on testnets forever. The LUNC community has the option to incentivize users to go on testnets and interact with production solutions before it goes live.

Deadlines have been given as May 27th, 2024, because the rewards in the oracle pool from the May '22 crash will expire by then. (Roughly ~May 9th, 2024)

This proposal will have a deposit created on January 31st, 2023 from the address terra1ld979rgsh2p5tfxx5rl5cp5r9kd4ke570xc9uf. Please use this deposit address as a way to track the proposal from this author. This additionally will be broadcasted on Twitter through https://twitter.com/wrapped_dday.

25 Likes

Can someone explain this in simple terms.

4 Likes

It’s a proposal asking for money.

3 Likes

What will happen if there are competition from other traders?

Wouldn’t it cause the prices of the assets involved in the arbitrage to converge, making the opportunity less profitable or even eliminating it altogether?

"For example, imagine an opportunity to buy a coin for $10 on one exchange and simultaneously sell it for $15 on another exchange. As more traders become aware of this opportunity and start buying the coin on the first exchange and selling it on the second, the demand for the coin in the first exchange will increase and its price will rise. At the same time, the supply of the coin on the second exchange will increase, causing its price to fall. As a result, the price difference between the two exchanges will decrease, making the opportunity less profitable.

Additionally, high-frequency traders and algorithmic traders can quickly identify and capitalize on arbitrage opportunities, making it harder for individual traders to execute their strategies.

Hence, competition among traders can cause the arbitrage opportunities to be short-lived or with less profits or even losses, as the market adjusts faster." -An extract. Will this have any impact on your proposal. For me I dont want the proposal to be the case of the emperor’s new clothes. I may be naive but I want to know.

3 Likes

“Let’s engage in price-fixing and cross our fingers we don’t get blacklisted.”

L1 team already set the hard cap to 2T.Apparently they make it easier and safer to try any ideas.

So what do we afraid of?Nothing! We can’t be worse than now.

Go and just do it!

4 Likes

0101010101010101$01$01$01$0$$$$01​:sunglasses::sunglasses::laughing:

1 Like

Translation: YOLO :rocket: :money_with_wings: :money_mouth_face: :rocket:

4 Likes

Gotta push hard on the exchanges if this passes… Binance, Binance.US, coinbase, mxc, kraken, all the big boys need to agree to this. Heavy push and influence on Binance to agree…but what do I know. I’m obese and old.

1 Like

if binance is willing to burn millions of dollars by burning for us I’m sure they would implement the code for us.

3 Likes

To bring the USTC to a value of 1 dollar using a soft peg algorithm, you first need to establish a target exchange rate for the soft peg, which in this case is 1 dollar. Then, you would need to determine a range for the soft peg, which can be done by adding or subtracting a certain percentage or fixed value from the target exchange rate. This range can be used to set boundaries for the USTC to fluctuate within. Next, you need to implement a mechanism for adjusting the USTC to move toward the target exchange rate within the established range. This can be done using various methods, such as changing the supply of the stablecoin, adjusting interest rates, or implementing incentives for market participants to buy or sell the stablecoin. Finally, you would need to put safeguards or “guardrails” to prevent the ERM from deviating too far from the target exchange rate and to prevent any potential adverse effects on the market.

It’s worth mentioning that this is a simplified version of the steps. In reality, it’s a complex process requiring much testing, monitoring, and fine-tuning to get the best results.

6 Likes

For USTC from $0.02237 to $1 using a soft peg algorithm, the following steps can be taken:

  1. First, could you determine the current exchange rate for the stablecoin? In this case, the exchange rate is $0.02237.
  2. Next, could you set the target exchange rate for the stablecoin? In this case, the target is $1.
  3. Could you determine the difference between the current and target exchange rate? In this case, the difference is $1 - $0.02237 = $0.97763.
  4. Could you set up the parameters for the soft peg algorithm? For example, the algorithm can adjust the exchange rate by 0.1% per block, with a maximum adjustment of 5% per day.
  5. I’d like you to begin implementing the soft peg algorithm. The algorithm will continuously adjust the exchange rate towards the target at a rate of 0.1% per block until the target exchange rate of $1 is reached.
  6. Could you monitor the exchange rate and adjust the algorithm as necessary? For example, the target exchange rate may change over time, and the algorithm may need to be adjusted to reflect these changes.
  7. Could you repeat the above steps until the exchange rate reaches $1?
10 Likes

Can someone explain this in simple terms.

1: Exchange rate for USTC = $0.02. This is our “soft peg.”
2: How high or low can we go before turning off our boosters? This is our “modifier range.”
3: How long are we keeping our boosters on? This is our “modifier duration”.
4: How much of a boost should we give? This is our “immediate modifier (range/duration)”.
5: Any other guard rails we should put on?
6: Run the booster until our guard rails kick in.

It’s like bowling, a bit. We want to throw the ball a little faster for a strike. Throw it out of control and it lands in the gutter – no pins landed. It’s the difference between these two photos:


@Kevin_Park

It’s a proposal asking for money.

It’s asking for code and for the community to work for a re-peg. If they don’t want to work, they can vote No. If they don’t want this code implemented, they can vote No. If they don’t want to bother with gathering cross-market consensus, they can vote No. Please read the proposal before making fundamentally inaccurate statements.

@Dannavan_Morrison

What will happen if there are competition from other traders?
Wouldn’t it cause the prices of the assets involved in the arbitrage to converge, making the opportunity less profitable or even eliminating it altogether?

Yes. That is the natural consequence of this proposal. Arbitrage happens as a result of inefficient market pricing. The pricing of this market is inefficient, but severely limited. We’ve put ourselves in a position where we have a load and are trying to lift it through force, but there is no fulcrum for this to work. This proposal is a modified design of the fulcrum of the original algorithm for fixed-supply instances of LUNC.

image

Additionally, high-frequency traders and algorithmic traders can quickly identify and capitalize on arbitrage opportunities, making it harder for individual traders to execute their strategies.

Hence, competition among traders can cause the arbitrage opportunities to be short-lived or with less profits or even losses, as the market adjusts faster." -An extract. Will this have any impact on your proposal. For me I dont want the proposal to be the case of the emperor’s new clothes. I may be naive but I want to know.

Currently, LUNC holders are being extracted through arbitrage carrying costs. The only reason their investment is protected is through the tax and staking yield; i.e., their principal is retained, but the ones who are making money are squeeze multi-hundred percentile profits through high-frequency trading (HFT).

Unfortunately for LUNC investors, these are really the only people who generate value for the network, except they all trade on Binance for lower spreads and fees and no taxes. It does not make financial sense to run a bot on-chain vs. on Binance.

Manual traders like myself have been relegated to DEX options farming which is difficult, slower, less profitable than staking, and expensive. If you want traders to trade without access to quant bots, you need them to have a platform to do so. They do not have a platform to do so. This proposal does not address this, but it asks for all of the money that’s on Binance or other CEXs to come back on-chain. We can reduce the tax to something low – maybe a few basis points – and then stakers will earn on transaction fees in high volume, which has been a complaint since #5234.

Also, this is why we test it in controlled zones as outlined in the pseudo-code algorithm.

@JCP.ESQ

“Let’s engage in price-fixing and cross our fingers we don’t get blacklisted.”

Every one of you are neck-deep in this already with having created the tax, which fundamentally affects the price of all wrapped and synthetic assets on all chains. You should be thankful we haven’t been blacklisted for this reason already, let alone charged on grounds for a myriad of reasons that are out of scope of this document.

Also, this is algorithmic price alterations. This differs from things like monetary policy which deliberately alter prices in favor of the governing body. For example, a 1.2% tax rate on all transactions is predictable for those capturing the value on this proposal, but unpredictable for those paying value into it. We can draw similar analogies to rates determined by governing financial bodies. If the FOMC decides that the funding rate is going to increase by 50 basis points, they essentially can frontrun their populace unless their decision-making processes are publicized. If neither the FOMC nor the populace can determine the increase or decrease of the funding rates except by math, then the gate is not whether or not the Fed likes you, but rather your proclivity for learning math.

6 Likes

Dear Duncan,
The proposal looks good.
I suggest you create a simulation with a spreadsheet to show how it works day by day. Otherwise, it is difficult to assess it with numbers.

3 Likes

If there is competition from other traders, it could impact the price of the USTC and make it more challenging to maintain its peg to the USD. One possible solution to mitigate this impact would be to have a mechanism that adjusts the USTC’s exchange rate in response to market conditions. This could be done by implementing a dynamic adjustment algorithm that considers the current market conditions, such as the trading volume and price of competing stablecoins, and adjusts the ERM’s exchange rate accordingly. Additionally, implementing a multi-oracle system, where multiple independent oracles provide exchange rate data, can help reduce the risk of manipulation and ensure that the USTCs exchange rate reflects the actual market conditions.

To improve the ERM algorithm to implement a dynamic adjustment mechanism. This would involve adjusting the ModifierRange and ModifierBlockDuration in response to market conditions rather than having fixed values. For example, during times of high volatility, the ModifierRange could be narrowed, and the ModifierBlockDuration increased to provide more stability. Conversely, during times of low volatility, the ModifierRange could be widened, and the ModifierBlockDuration decreased to allow for more flexibility.

5 Likes

A easy way to cancel the arbitrary code is to not allow the Ustc withdrawal easy as it sound …

Hi man

You seems know what you talking about so try to create an better proposal and put for vote for the community :face_with_monocle::face_with_monocle::face_with_monocle:

3 Likes

As stated before this might be part of the solution. I think that ustc staking rewards should be taxed with 50% or more until supply is not down to 5b ustc. That way repeg might be quicker.

Since I like gambling and I do believe ustc can be slowly pegged to higher levels I put some $$ into ustc today… will hold for a year. Risk reward ratio is good enough for me here :slight_smile:

Fingers crossed this proposal will be enough!

1 Like

Additionally, implementing a multi-oracle system, where multiple independent oracles provide exchange rate data, can help reduce the risk of manipulation and ensure that the USTCs exchange rate reflects the actual market conditions.

I have some preliminary research under a project name called Titan that can scale oracle functionality through sub-groups if necessary. Ideally, it would be to flatly distribute voting power across the system, but it opens it up to Sybils. This research is done under Onyx, and I would look to scale it with Algorand, potentially. (They do not work cross-chain much.)

To improve the ERM algorithm to implement a dynamic adjustment mechanism. This would involve adjusting the ModifierRange and ModifierBlockDuration in response to market conditions rather than having fixed values. For example, during times of high volatility, the ModifierRange could be narrowed, and the ModifierBlockDuration increased to provide more stability. Conversely, during times of low volatility, the ModifierRange could be widened, and the ModifierBlockDuration decreased to allow for more flexibility.

Thanks for the writings, these look great. Here are some graphs of how I visualize some of the general movements: Rough Visualizations

As |a| increases, the more compression occurs on the modifications. As b changes, the point of compression changes. Might be an interesting way to determine various aspects of the algorithmic functionality – I find that Terra <> Luna is closer to a sinusoidal function.

4 Likes

Duncan, what would it take to get the ball rolling on this and implement it? Does it have to be on the test net first before it can go to mainnet? do we need to provide capital to get it movign forward?

2 Likes