Fyde Contract

The Fyde contract serves as the core contract of the Fyde protocol. It handles the logic for depositing, withdrawing, and swapping assets within the protocol.

Fyde operates as a diversified vault, accepting certain assets, each with a specific target concentration representing the asset’s desired weight in the protocol relative to the Total Value Locked (TVL) in USD. Target concentrations represent the ideal weight of a given asset in the protocol as part of an overarching portfolio management strategy. Users can deposit, withdraw, and swaps these assets in the Fyde protocol.

Deposit

Approved assets can be deposited by users, and upon deposit, $TRSY is minted to the user. Minted $TRSY represents a share of the vault that is proportional to the deposited amount denominated in USD.

For instance, if a user deposits 100 TokenA, equivalent to 100k USD, and the TVL is 1 million USD with 500k $TRSY in circulation, the user will receive 50k $TRSY.

Withdraw

Users can withdraw assets by burning their $TRSY tokens. The withdrawal value is computed using mechanisms akin to those used in depositing.

For example, if a user holds 50k $TRSY and the TVL is 1 million USD with 500k $TRSY in circulation, the user can withdraw 10% of the index vault, equivalent to 100k USD.

Slippage

Every token in the vault is associated with an ideal concentration, or weight, which is set in order to target specific risk metrics corresponding with each token. Vault actions such as deposits, withdrawals, and swaps can begin to deviate asset concentrations from their target, and as a result, fundamentally change the risk profile of the overall vault. In order to minimize the impact of actions that can negatively impact the health of the vault, slippage will occur on the trade.

For instance, deposits altering the concentration towards an overweight position will incur slippage, as will withdrawals from an underweight asset. On the other hand, withdrawals of overweight tokens and deposit of underweight ones will be completely slippage-free.

Slippage on Deposits

An overweight asset can be thought of as a token that has drifted outside of its slippage-free zone. This range is usually centred around the target concentration (Ci0)(C_{i}^0) that is set for each token ii. The upper bound of this range (or the deposit limit) is set by a factor (xiU)(x^{U}_{i}) of the target concentration. When an asset passes the limit, slippage will incur on subsequent deposits, proportional to how far above this limit the concentration has moved. The slippage is computed only on the proportion of the deposit made above the limit , where DiD_{i} is the USD value of each individual deposit and TDT_{D} is the total deposit value.

Dia=min(max(Di+TVLCixiUCi0(TVL+TD),0),Di) .\begin{equation*} D^a_i = \min\left(\max\left(D_i + T_{VL}C_i - x^{U}_iC^0_i(T_{VL} + T_D),0\right),D_i\right)\ . \end{equation*}

Since multiple tokens can be deposited simultaneously, the total slippage amount is computed as a sum of the percent of each deposit made above the upper concentration limit DiaD^{a}_{i}. This percentage is proportional to how far above the upper limit the deposit is made, up to a maximum percentage cmaxUc^U_{max}.

Tτ=i=1NDiamin(TVLCi+DixiUCi0(TVL+TD)1,cmaxU) .\begin{equation*} T_{\tau} = \sum_{i=1}^N D^a_i \min\left(\dfrac{T_{VL}C_i+D_i}{x^{U}_iC^0_i(T_{VL} + T_D)} - 1,c^{U}_{max}\right)\ . \end{equation*}

Slippage on Withdrawals

Slippage will similarly occur on withdrawals of underweight tokens. As with deposits, only the proportion of the withdrawal made below the lower limit (WibW_{i}^b) will be impacted by slippage.

Wib=min(max(WiTVLCi+xiLCi0(TVLTW),0),Wi) .\begin{equation*} W^b_i = \min\left(\max\left(W_i - T_{VL}C_i + x^{L}_iC^0_i(T_{VL} - T_W),0\right),W_i\right)\ . \end{equation*}

The slippage incurred on each token for multi-token withdrawals is again proportional to far below the concentration limit the withdrawal occurs, up to a maximum percentage cmaxLc^L_{max}.

τi=Wibmin(1TVLCiWixiLCi0(TVLTW),cmaxL) . \begin{equation*} \tau_i = W^b_i \min\left(1-\dfrac{T_{VL}C_i-W_i}{x^{L}_iC^0_i(T_{VL} - T_W)},c^{L}_{max}\right) \ . \end{equation*}

Last updated