Sett Contract
Summary
The Sett contract is the user-facing part of the Sett system, and manages deposits and withdrawals.
Each Sett manages a single underlying token, depositing it into strategies to generate yield and increase the position of users who deposit. Returns are realized upon withdrawal. (Some strategies may have additional rewards which are realized via a separate mechanism, such as the HarvestCurveMetaFarm)
Permissioned Roles
Governance has the ability to:
Set the minimum threshold of deposits that are kept outside of strategies (This is primarily used to keep a small reserve for decrease the cost of small withdrawals, though can also effectively be used to pause deposits)
Change the Governance and Controller contracts.
Controller refers to the controller contract which facilitates actions on the vault, and the switching of strategies. It is ultimately governed by its' own Strategist and Governance.
Deposit
A user can deposit tokens at any point. They will receive shares that entitle them to a portion of the underlying assets in the Sett & Strategy. At the time of deposit, they should be able to claim the amount they initially deposited, minus fees. As the Strategy realizes gains, the pool of underlying will grow, increasing the value of each share.
Deposited tokens pool in the Sett, and are sent to the active Strategy via the Controller when deemed efficient. By letting small funds pool up, we dramatically reduce the gas costs on individual users. Shares are fully transferrable.
Withdraw
Users can withdraw shares at any time, receiving the proportion of underlying they are entitled to. Excess underlying in the Sett will be withdrawn first, followed by idle underlying in the Strategy. If more is required to cover the withdrawal, the Strategy will unroll sufficient underlying from its' positions. Typically, a Sett will keep a small portion of deposited funds in reserve to handle small withdrawals cheaply.
Understanding Share Value: getPricePerFullShare()
Shares represent a claim to a portion of the underlying asset within the system (Whether present in the Sett or active Strategy).
The getPricePerFullShare() function allows anyone to view the expected value of a share redeemed at the current block. This does not take into account fees that will be realized upon withdrawal (namely the Withdrawal fee, if present)
Flash Loan Mitigation
Deposits, withdrawals, and vault token transfers by a user are subject to a "block lock", which means that only one of these operations can be performed with a single block. This ensures that users attempting to perform flash loans with rented funds within a block are unable to do so.
In addition, deposit and withdraw actions can only be taken by EOAs (externally owned accounts). While a blunt instrument, this also prevents single-block rented flash loan attacks. However, this limits functionality for users of smart contract wallets, and will possibly be removed as the project security is hardened. We believe the previous "block lock" mechanic covers the same threat vectors.
Last updated
Was this helpful?