Unleashing Your Yield — How Sandglass Works

Lifinity
9 min readApr 15, 2024

--

In our previous article, we laid out the vision for Sandglass. In this article, we’ll be taking a closer look at the inner workings of Sandglass that enable yield trading.

While there is no good way to trade yield on Solana right now, we are in fact not the first protocol to enable it. Yield trading has been tried before on Solana using order books, but this proved difficult due to the need for many market makers to provide liquidity, among other things.

Following the lead of Pendle on Ethereum, Sandglass utilizes a pool model where users deposit yield-bearing tokens in a special type of AMM designed for yield trading (with some important differences). Because the AMM handles all the pricing logic, users can be passive LPs, making it much easier to bootstrap and scale liquidity and in turn provide deep liquidity for yield traders.

The Principal and the Yield

Yield-bearing tokens (YBT) are derivatives of another token that can generate yield. For example, mSOL is a YBT because it is created by staking SOL — the “underlying” — and earns Solana’s native staking yield.

Sandglass takes YBT and splits them into their principal and yield components, enabling each to be traded separately. The tokens representing the principal are called principal tokens (PT) and the tokens representing the yield are called yield tokens (YT).

Sandglass’ assets are governed by a simple, universal equation:

YBT = PT + YT

Although the prices of PT and YT will change over time, whatever is lost by one is gained by the other, so their sum will always be equal to the price of YBT.

PT and YT are created through a straightforward minting process: deposit YBT and receive the same amounts of PT and YT.

The same works in reverse: deposit equal amounts of PT and YT to redeem the same amount of YBT.

Before we can explain how the values of PT and YT track what they represent, we need to understand the concept of maturities. We can’t meaningfully talk about trading yield without first specifying a time frame. An asset can have wildly different yields over the course of a day compared to a year. Even if we are comparing the same amount of time, say one month, this month’s yield is unlikely to be the same as the next month’s yield.

Therefore, when a user deposits YBT into Sandglass, they will choose from among a number of vaults with different maturities. When a vault reaches maturity, two things happen:

・PT becomes redeemable for YBT worth however much of the underlying it was worth at the start of the vault
・YT becomes redeemable for its proportional share of the vault’s yield from YBT accumulated throughout the vault’s lifetime

The market prices of PT and YT naturally converge to these values as they approach maturity, since that is what they will be redeemable for at maturity.

An illustration of the prices of PT and YT over time in an idealized scenario. sUSDC is an imaginary asset representing staked USDC with an unchanging APY of 25% and starting at a value of 1 USDC. PT starts with a value of 1/1.25=0.8 USDC and at maturity becomes worth 1 USDC, which is what sUSDC was worth at the start of the vault. YT starts with a value of 0.25/1.25=0.2 USDC and at maturity becomes worth 0.25 USDC since the yield on sUSDC over the course of the year was 25%.
An illustration of the prices of PT and YT over time in a realistic scenario. sUSDC’s APY is 25% at the vault’s inception, but varies over time and averages out to 50% over the course of a year.

Note: In Pendle’s model, YT holders can claim the yield each time it accrues, thus the value of YT heads to 0 as its vault approaches maturity. This results in the inconvenience of having to claim rewards frequently. Taking mSOL as an example, it would be like having to manually claim your SOL staking rewards each epoch. In actuality, the value of mSOL simply increases in terms of SOL each epoch. YT works the same way on Sandglass. Keeping the yield within YT also improves composability, as there is no need to track YT deposited into other protocols in order to distribute yield, and YT can more easily be used as collateral since its value is not continuously decreasing.

Next, we turn to how Sandglass’ automated market maker (AMM) enables PT and YT to be traded.

The Yield AMM

Rather than give a deep technical overview, our goal in this section will be to provide an intuitive understanding of how Sandglass’ Yield AMM (YAMM) works. Importantly, you don’t need to understand what follows in order to trade yield or provide liquidity! If at any point you find yourself feeling confused, feel free to scroll down to the Strategies section.

The basic idea behind the YAMM is to use a PT-YT pool to concentrate liquidity around YBT’s yield. This may be a bit difficult to grasp at first since those who are familiar with DEXs are used to thinking in terms of concentrating around a price rather than an APY. Even though the YAMM does in fact quote prices, it is natural to denominate figures primarily in APYs as users will be deliberating their trading decisions in terms of APYs (“Will the yield increase or decrease from here?”).

Since YBT = PT + YT and the pool knows the relative prices of PT and YT, the pool can facilitate swaps between any two assets among PT, YT, and YBT. This makes it unnecessary to create separate markets for each pair of assets, thereby avoiding fragmentation of liquidity.

Put any asset in, get any asset out.

Let’s consider what happens under the hood for a number of swaps between different assets.

Trading PT for YT is simple; just like any other AMM, you send PT to the pool and the pool sends you YT.

How about trading YBT for PT? In this case the pool cannot directly accept YBT since it is a PT-YT pool. Therefore, the YBT is first split into its PT and YT components. Since we are trading into PT, the PT component is already in the desired asset. The YT component can be converted to PT by swapping through the PT-YT pool.

If we reverse the trade from PT to YBT, the YAMM will calculate the precise amount of PT to swap to YT such that you are left with the same amount of PT and YT, and will then combine the PT and YT into YBT.

As mentioned above, liquidity is concentrated around YBT’s yield. But this yield is not static, and indeed that is the whole reason behind the demand to trade it. This creates an opportunity for arbitrage between the realized APY and the APY that a pool concentrates around, which would result in impermanent loss (IL) for LPs. To counteract this effect, the YAMM adjusts the APY (PT-YT price) it concentrates around based on the yield that is actually realized, rather than relying on arbitragers to adjust the price (as in Pendle’s model). For those who are familiar, this is similar to how Lifinity’s DEX adjusts a pool’s price according to the oracle price, which enables more accurate pricing and mitigates IL.

Given that IL may be a concern, it is worth mentioning that there is empirical evidence that LPs on Pendle experience negligible IL, and we expect the same to be true for Sandglass LPs. In fact, relative to TVL we can expect more yield trading volume on Solana since transaction fees are negligible, and this will make the ratio of a pool’s fees to IL more favorable. Additionally, since the risk of IL is proportional to volatility and yields tend to be much less volatile than prices, providing liquidity on Sandglass should generally be a less risky endeavor than, for example, providing competitive liquidity for volatile asset pairs on a CLMM.

Note: Pendle settled on using PT-YBT pools (PT-SY in their nomenclature) rather than PT-YT pools. We believe PT-YT is a more natural and intuitive design choice, as any opinion on the yield is ultimately expressed by trading between the principal and the yield, not between the principal and the yield-bearing token. It is also simpler to implement, which helps reduce code complexity. Combined with our unique price curve, which can be most succinctly described as a dynamically price adjusting concentrated Balancer pool, the YAMM is able to utilize assets more efficiently.

⏳ Strategies ⏳

So how can you use Sandglass to generate a profit? While there are limitless possibilities, here are some basic strategies that users can employ.

・If you think the yield will decrease (or will stay the same when PT yield > underlying yield), you can buy PT and wait until maturity to receive YBT. If you are right, you will end up with more YBT than if you had just held YBT and not converted it to PT. Even if you are wrong, you will have locked in a fixed yield (the yield you bought PT at) rather than receive the variable yield of the underlying. This is why the yield on buying PT is called the Fixed APY.
・If you think the yield will increase (or will stay the same when YT yield < underlying yield), you can buy YT and wait until maturity to receive YBT. If you are right, you will end up with more YBT than if you had just held YBT and not converted it to YT. The yield on buying YT is called the Long Yield APY — the APY of buying YT at the current YT yield and assuming that the underlying yield remains constant until maturity.
・If your YBT is sitting idle in your wallet, you can passively provide liquidity to earn yield on top of your already yield-bearing tokens via a single-token deposit.

Let’s walk through a concrete example to see how these strategies work in practice. Suppose mSOL currently yields 7%, and we open a 1-year vault.

・Alice thinks the yield will decrease over the course of the year, so she locks in the 7% APY by selling her mSOL for PT mSOL. No matter what happens to the yield, by the end of the year Alice will have earned a 7% APY, and her PT mSOL will become redeemable for the amount of mSOL that exactly represents a 7% APY.
・Bob instead thinks the yield will increase, and he bets on this outcome by trading his mSOL for YT mSOL. If the yield gradually increases from 7% to 8% over the course of the year for an average yield of 7.5%, Bob will have generated an APY of 14.6%, over double the initial yield! Small movements in yield can lead to outsized returns in the long yield APY.
・Claire thinks the yield will more or less stay the same throughout the year, so she doesn’t want to trade. However, she is happy to provide liquidity by depositing her mSOL in the pool and earn trading fees from traders such as Alice and Bob.

The above example uses an asset whose yield is denominated in the same asset (staked SOL generates SOL yield), but some assets generate yield in a different asset (for example, locked LFNTY generates USDC yield). The strategy space for these assets is even wider, since you can express your view not just on the yield but also on the relative prices of the underlying and yield assets.

⏳ Wen Launch? ⏳

Sandglass is for any token with yield. It’s one of the few places where you can earn yield on top of your already yield-bearing tokens. This in turn benefits protocols with yield-bearing tokens, making their TVL stickier. PT eliminates uncertainty regarding their yield, YT enables betting on yield apart from price, and LPs facilitate trades between them. Sandglass creates win-win opportunities for all parties involved.

Sandglass has passed Sec3’s automated security audit via X-Ray with 0 issues, and we are aiming to undergo a formal audit in June.

Our app will launch soon, starting with an mSOL vault and with plans to add more vaults. During our beta phase, trading will be open to all while LP deposits will be closed; we will first test the profitability of liquidity provision with Lifinity’s protocol-owned liquidity by providing highly concentrated liquidity, ensuring traders can trade with minimal price impact. Once we are satisfied with the results, we will open up for LP deposits.

Get ready to begin your yield trading journey! ⏳

To stay up to date, follow us on Twitter and join our Discord!

Twitter: https://twitter.com/sandglass_so
Discord: https://discord.gg/7x79v6a6bG

--

--

Lifinity

The first proactive market maker on Solana designed to improve capital efficiency and reduce impermanent loss.