🏨High Level Architecture
Last updated
Last updated
Fyde is comprised of a single vault of whitelisted assets. In order for the vault to maintain its asset allocation strategy, corresponding concentration limits and target concentrations are specified. Users (depositors, bots, etc.) will be incentivized to bring tokens to their proper weights in the vault, and be disincentivized from pushing token allocations too far from their respective target concentrations.
As a result, withdrawing and depositing underweight and overweight tokens, respectively, will result in slippage for the user. Conversely, there won’t be slippage for withdrawals/deposits of overweight/underweight tokens. When the vault needs to rebalance assets to meet its concentration targets, token swaps in desirable directions will offer a reward for arbitrageurs by pricing the assets at a discount to the market.
For the user, most of this is abstracted to a single "slippage" parameter. Users can simply select the "Slippage Free" toggle on their token selection window to quickly identify which tokens they can optimally deposit or withdraw.
The deposited tokens are priced using oracles, which consists of a combination of a Chainlink price feed along with a UniswapV3 TWAP. These prices are used to price the USD value of the deposit/withdraw to mint/burn an equivalent of $TRSY tokens representing the user’s overall share of the combined holdings of the vault. Users can also withdraw from the vault by burning their $TRSY tokens. Users should keep in mind the potential withdrawal taxes when doing this (e.g. if the user is withdrawing underweight tokens).
Users can also choose to retain their governance rights over a particular token. This option is similar to a standard deposit, however, instead of the assets being deposited into the combined holdings of the vault, a separate custodial contract is generated for the user and the tokens are transferred there directly.
The proportional value of $TRSY is still minted, but will be automatically staked on the custodial contract as well—issuing the user “staked $TRSY” ($gTRSY) instead. This custodial contract allows the user to retain the governance power of these tokens by giving them the ability to choose a wallet address or a Snapshot space to delegate to.
Users should keep in mind that the value of this custodial contract is determined by the amount of $TRSY tokens staked on it, which means that if the corresponding governance token outperforms/underperforms the value of the overall vault, a proportional number of tokens will be moved from/to the contract to be made available for the deposit/withdrawal/swap actions taken by other users. A user can, at any time, withdraw the contents of the their custodial contract directly by burning their $gTRSY. Alternatively, they can unstake their $gTRSY and receive $TRSY. Although this action will permanently give up their governance rights, they will likely be able to access greater market liquidity if they want to trade the $TRSY token.
Protocol architecture is composed of four main smart contracts:
Relayer: contains the entry points into the protocol for users, as well as the protocol automation logic performed by keepers.
Fyde: contains the main logic of the protocol, allowing for depositing, withdrawing, and swapping of assets.
OracleModule: allows for obtaining on-chain pricing of assets.
GovernanceModule: contains the logic allowing a user to retain governance rights over their assets.