System Architecture

The SugarYield Markets operate on the BNB smart chain environment.

Controller

A function used by Keepers to initiate events that affect the Vaults.
TriggerEndEpoch: Triggers the end of an epoch and transfers the Caramel vault premium to the Saltish Vault, closing the epoch.
TriggerDepeg: Triggers if the epoch has not ended and the oracle reports a price lower than the Vault Market strike price, swapping the Caramel Vault premium with the Saltish Vault, and closing the epoch.
TriggerNullEpoch: Triggers if, after the insurance epoch has begun and one of the Vault Markets has zero deposits, allowing everyone to withdraw their deposits since there is no possibility to resolve this Market.

Vault

A function used by Users to create ERC 1155 positions, where the ID of the token is represented by the Unix Timestamp of the last second of an Insurance Epoch.
Deposit: Transfers WBNB and creates 1 to 1 an ERC1155 token corresponding to that epoch.
Withdraw: Takes a fee if there is profit in this position and calculates the user's entitlement, which corresponds to the user's % shares of this Vault before the insurance epoch began.

Vault Factory

A function used by Sugar Yield admins to create Markets and corresponding Vaults, and for deploying new epochs for already created Markets.

Staking Rewards

A function that allows users, after creating Vault Market tokens (ERC1155 tokens), to deposit these tokens inside Staking Rewards to earn Sugar Yield tokens. This is designed to incentivize deposits in certain Vault Market Positions, with Sugar Yield token rewards varying based on Market conditions.