Crate tulipv2_sdk_farms

Crate tulipv2_sdk_farms 

Source
Expand description

Provides a Farm type used to describe different platforms (ie Raydium), and and farms within those platforms (RAY-USDC). The underlying representation of the Farm type consists of a 2 element u64 array. The first element of the array identifiers the platform, while the second element of the array identifies the farm type. In addition to identifying vaults the Farm type serves a secondary purpose, which is to ensure vault address generation is deterministic.

In certain circumstances, the same Farm type may be used for multiple vaults, so to prevent deterministic address generation of Solana PDA’s from causing collisions, a the underlying representation of the Farm type is combined with a 32 byte tag, defaulting to [0_u8; 32]

For the rest of the comments/docs the first element of the underlying representation will be called the Farm Identifier and the second element will be called the Farm Name. Farm names are defined within modules in appropriately named files (lending.rs, orca.rs, etc..)

Within the files for the farm names there may be enum variants with names such as PLACEHOLDER_XYZ. These are intended to allow creation of new vault types without needing to upgrade the program to enable a new set of farm names to be valid.

Modules§

atrix
lending
lending platforms
orca
farm types supported by orca
quarry
farm types supported by Quarry, Saber, and Sunny
raydium
farm types supported by raydium
unknown
a catch all farm type indicating an unknown farm / error

Enums§

Farm
the core type, which bundles together a “Farm Identifier” and “Farm Name” to uniquely identify vaults supported by Tulip V2.

Functions§

farm_identifier_stripper
used to strip the farm identifier portion of a farm type, returning only the farm name