# Staking USDX

*USDX* holders can earn rewards by staking *USDX* for *sUSDX.*

> Users will always receive the principal amount of *USDX* staked as well as their proportionate share of the deposited protocol yield upon **unstaking**.

Staking is controlled by the StakedUSDX smart contract. Stakers can interact with it directly or through <https://usdx.money/stake>.

* When **staking**, a user transfers *USDX* into the contract and receives *sUSDX* (staked *USDX*), another ERC20 token that represents a fractional interest in the *USDX* in the contract.
* Over time, a portion of protocol revenue accumulates in the staking contract as additional *USDX* is transferred in.
* When **unstaking**, *sUSDX* is burned in exchange for a proportionate *USDX* amount. For faster conversion into aforementioned stablecoins, users can swap *sUSDX* into *USDX* through liquidity pools (LPs).

## Introduction

The StakedUSDX smart contract implements the [ERC4626 Token Vault standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626/) for composability. This popular standard is widely used for onchain savings vehicles; thus, it is expected that other user interfaces beyond the usdx.money dApp may likely support *USDX* staking in the future. Various deposit and redeem functions are exposed, enabling staking with or without a slippage threshold, and with or without an ERC2612 Permit signature authorizing the transfer of *USDX*. There is no minimum staking period. If a user **stakes** and **unstakes** in consecutive blocks, they are entitled to their share of any increase in vested *USDX* value in the contract that has occurred in that \~12-second period. Because reward payments into the contract occur every 8 hours and linearly vest over 8 hours, there are never any sudden spikes in the vested *USDX* value, which prevents sandwich attacks where an informed staker stakes before and unstakes after payment at the expense of all other stakers.

> Stakers cannot lose *USDX* by **staking**. *USDX* transfers of rewards can only be positive into the StakedUSDX contract. As such, the *USDX* value of *sUSDX* can only increase or stay flat over time.

Staking rewards accrual is a function of the protocol's generated yield from earning the funding and basis spread from the delta hedging derivatives position. While protocol generated yield should remain fairly stable unless there is a slashing event, the funding and basis spread yield from delta hedging derivatives will vary considerably (even day to day). In some periods, no yield may be paid to staking users if the funding + basis spread yield is negative. In this situation, when no protocol yield is transferred to the StakedUSDX smart contract, the usdx.money insurance fund will ensure the underlying protocol collateral remains untouched.
