stXTZ - Liquid Staked Tezos
stXTZ is a FA2 compliant token, representing staked XTZ, Tezos' native token. stacy.fi, built buy Youves contributors, is a staking platform which allows users to earn staking rewards on Tezos while maintaining full liquidity of their funds, by holding stXTZ tokens.
#
IntroductionTezos' Paris B protocol upgrade came with the novelty that holders of XTZ needed to decide if they want to continue using delegation with less rewards than before or to stake their XTZ for full rewards, but then also accept their XTZ being locked for 14 days after unstaking. This protocol upgrade had a big impact on DeFi platforms like youves: smart contracts which lock XTZ would not be able to profit of staking, therefore these products suddenly became a lot less atractive for users.
To counter this, youves core contributors from Ubinetic teamed up with Acurast to come up with a solution similar to staking tokens in other ecosystems, for example stETH (Lido) on Ethereum: Users deposit the native currency (XTZ) and receive a token (stXTZ) which accrues the baking rewards.
#
stXTZ propertiesstXTZ is FA2 compliant token which represents a share of the stXTZ staking pool. stXTZ has a value expressed in XTZ which can easily be calculated by dividing the sum of all staked XTZ in the stXTZ pool by the total supply of stXTZ.
For example, if the solution holds 11000 staked XTZ and stXTZ has a supply of 10000, the value or price of 1 stXTZ is 1.1 XTZ.
As staking rewards are continuously received by the pool of stXTZ bakers, the price of stXTZ slowly increases - staking rewards are accrueing in the stXTZ token. A view on the pool contract always returns the current price of stXTZ/XTZ.
For example, if the solution now receives 5 XTZ in rewards, it holds 11005 staked XTZ, but the supply of stXTZ remains at 10000. Therefor the new price of 1 stXTZ is 1.1005 XTZ.
But where there are rewards, there are risks as well: If any of the stXTZ bakers gets slashed for double baking or other punishable events while participating in Tezos validation, the price of stXTZ can suddenly decrease, because slashing immediately reduces the staked balance.
#
How does it work?Stacy.fi was build on the following components:
#
Smart contracts#
Pool contractThe pool contracts keeps track of the staked balance and the intermediate states between depositing and staking as well as unstaking and withdrawal of funds. It mints or burns stXTZ, when triggered by a manager, an automated signer (read more about their role below). The pool contract also holds a list of allowed managers. The pool mainy consists of queues which ensure to keep track of staking/minting and unstaking/burning processes. If a user decides to unstake stXTZ, the pool ensures that Tezos' current waiting period for unstaking operations is enforced.
#
Token contractThe stXTZ token contract is an FA2 compliant token contract, which can be used in any DeFi protocol on Tezos. stXTZ, which accrues the staking rewards in it's value, is the token with ID 0. The stXTZ staking pool contract can mint and burn stXTZ tokens.
#
Gasstation contractAdditionally youves contributors created a simple gasstation contract, which can be called by a list of allowed entities, like the managers or other future signers or bots. This solves an issue which youves contributors encountered in the past, when using automated signers: they can run dry and it's easier to monitor and refill one address instead of whole list of signers.
#
Manager contractThe manager contract contains a list of Acurast signers which are sharing the same private key in a secured P2P network. They are acting as one Tezos account towards the protocol. The manager contract also contains the script which runs on the Acurast signers. Only Acurast signers whitelisted in this contract and running this exact script can interact with the protocol.
#
stXTZ/XTZ cpmmAlongside with the staking pool setup, a CPMM will be deployed, which allows users to sell stXTZ directly against XTZ, without having to wait 14 days (under the current Tezos protocol), while other users can buy stXTZ at a discount in order to unstake or use them.
#
ManagersManagers act as bakers towards the protocol, but they are not running Tezos baking nodes, they are using the consensus keys of baking nodes run by third parties. One manager is a cluster of Acurast signers. They observe the pool contract for new deposit or withdrawal requests. If such a request is detected, the manager executes a transaction which triggers staking of XTZ and minting of stXTZ or unstaking of XTZ and burning of stXTZ.
The manager guarantees that these operation pairs (staking+minting or unstaking+burning) are executed in a single atomic transaction. This guarantees that the staking operation takes place at the same time as the mint operation when XTZ is being exchanged for stXTZ. Likewise, the burning of stXTZ takes in the same block as as the unstake operation is injected.
#
Baking node(s)Initially the solution starts with one baking node, run by Ubinetic AG, by experienced baking node operators. Mid-Term, the this could be developed into a more distributed setup of more operators.
#
Reward DistributionAs baking rewards are received, managers constantly monitor the balances and update the tracked balances in the pool contract. This means the amount of XTZ backing all stXTZ tokens in circulation is gradually increasing, which, in turn, causes the value of 1 stXTZ token (expressed in XTZ) to rise slowly. In the event of a slashing, the managers also track the balance change in the stXTZ pool contract, and the value of 1 stXTZ token may decrease.
Additionally, each time the signers detect a balance increase due to baking rewards, 20% of these rewards will be immediately minted as stXTZ at the current stXTZ/XTZ price as the pool contract calculates it on every update. These stXTZ tokens will be sent to the Youves DAO reward collector. From there, 50% of the collected stXTZ rewards will be distributed as compensation to the baking node provider, while the other 50% will be retained by the DAO for future YOU token buybacks, in the same way current rewards from engines and swaps are managed. This means that 80% of the staking rewards will be accrued inside the stXTZ token. These initial parameters can be adjusted through a governance vote as the protocol evolves.
#
Is it safe to interact with this?All involved smart contracts and Acurast scripts have undergone extensive testing and a security audit by both internal developers and an external third party. The smart contract logic has been simplified as much as possible to ensure safe and predictable operation. However, certain risks may still remain at the code level, system level, and due to the nature of staking on Tezos. Slashings can occur if the baker does not function as intended.
#
How is the youves DAO involved?stacy.fi, the stXTZ solution, was developed by the youves core contributors from Ubinetic AG, on behalf of the youves DAO. stXTZ will serve as an additional source of rewards for the youves DAO. If the governance vote is accepted, the youves DAO, which consists of the combined vote weight of all YOU token stakers, will be the sole entity responsible for administering the stXTZ pool contract, the token contract, and the manager contract.
All fees collected by the stXTZ solution are gathered by the reward collecting contract, which is controlled by the Youves DAO and the Youves keyholders.