Crate yi

Source
Expand description

Yi Token by Crate Protocol: the primitive for auto-compounding single token staking pools.

§About

Yi is a Solana primitive for building single-sided, auto-compounded stake pools. It allows projects to launch Yi Tokens, which are tokens convertible to and from an underlying token.

Some example use cases include:

  • Governance token staking. Protocols may want their governance token to be staked, where fees are converted into the governance token. An example of this is the XSUSHI pool in Sushiswap.
  • Interest-bearing derivatives. A protocol may collect revenue in a token that it wants users to stake, so it may pay fees out by compounding that token. An example of this is Anchor UST.

§Usage

First, create a Yi Token by invoking the yi::create_yi_token instruction. Then, anyone may stake tokens into the pool via yi::stake.

To send auto-compounded rewards to the pool, deposit tokens to the YiToken::underlying_tokens token account. This will increase the conversion rate of Yi Tokens to underlying tokens.

To exit the pool, invoke yi::unstake.

§Fees

Yi Tokens may take stake or unstake fees. These fees cannot be changed after the construction of the Yi Token. Fees get distributed to stakers within the Yi Token pool.

§Packages

§Address

The Yi program is deployed on mainnet-beta and devnet at YiiTopEnX2vyoWdXuG45ovDFYZars4XZ4w6td6RVTFm.

§License

Yi Token by Crate Protocol is licensed under the Affero General Public License, version 3.0.

Modules§

accounts
An Anchor generated module, providing a set of structs mirroring the structs deriving Accounts, where each field is a Pubkey. This is useful for specifying accounts for a client.
instruction
An Anchor generated module containing the program’s set of instructions, where each method handler in the #[program] mod is associated with a struct defining the input arguments to the method. These should be used directly, when one wants to serialize Anchor instruction data, for example, when speciying instructions on a client.
program
Module representing the program.
yi
The yi program.

Macros§

yitoken_seeds
Generates the signer seeds for a crate::YiToken.

Structs§

YiToken
A YiToken is an SPL Token which auto-compounds an underlying token.

Enums§

ErrorCode
Errors.

Constants§

MILLIBPS_PER_WHOLE
Number of millibps in 1.

Statics§

ID
The static program ID

Functions§

check_id
Confirms that a given pubkey is equivalent to the program ID
entry
The Anchor codegen exposes a programming model where a user defines a set of methods inside of a #[program] module in a way similar to writing RPC request handlers. The macro then generates a bunch of code wrapping these user defined methods into something that can be executed on Solana.
entrypoint
Safety
id
Returns the program ID