Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SFVault

SFVault is an ERC-4626 vault that accepts a specific kitchen token as its underlying asset and delegates asset management to a pluggable strategy.

Read Functions

Asset & Share Accounting


asset() → address

Returns the underlying kitchen token address.


totalAssets() → uint256

Returns total managed assets (vault balance + strategy balance - locked profit). Locked profit is subtracted to prevent sandwich attacks around harvests.


totalSupply() → uint256

Returns total vault shares outstanding.


balanceOf(address account) → uint256

Returns vault share balance for an account.


Conversion Previews


convertToShares(uint256 assets) → uint256

Converts an asset amount to the equivalent shares (without fees).


convertToAssets(uint256 shares) → uint256

Converts a share amount to the equivalent assets (without fees).


previewDeposit(uint256 assets) → uint256

Returns shares you would receive for depositing the given assets.


previewMint(uint256 shares) → uint256

Returns assets required to mint the given shares.


previewWithdraw(uint256 assets) → uint256

Returns shares that would be burned to withdraw the given assets.


previewRedeem(uint256 shares) → uint256

Returns assets you would receive for redeeming the given shares.


Deposit/Withdraw Limits


maxDeposit(address) → uint256

Returns maximum assets that can be deposited. Returns 0 if paused or deposit cap reached.


maxMint(address) → uint256

Returns maximum shares that can be minted. Returns 0 if paused or deposit cap reached.


maxWithdraw(address owner) → uint256

Returns maximum assets the owner can withdraw.


maxRedeem(address owner) → uint256

Returns maximum shares the owner can redeem.


Other


previewHarvest(address wrapper) → (address[] tokens, uint256[] amounts)

Returns the tokens and amounts that would be harvested. Not all strategies support this.


paused() → bool

Returns true if deposits are paused.


Write Functions


deposit(uint256 assets, address receiver) → uint256 shares

Deposits kitchen tokens and mints vault shares to the receiver.

  • Requires: not paused, assets ≥ minDeposit, won't exceed depositCap
  • Assets are automatically staked into the strategy

mint(uint256 shares, address receiver) → uint256 assets

Mints exact vault shares by depositing the required assets.

  • Requires: not paused, assets ≥ minDeposit, won't exceed depositCap

withdraw(uint256 assets, address receiver, address owner) → uint256 shares

Withdraws exact assets by burning the required shares.

  • Works even when paused
  • Automatically unstakes from strategy if needed

redeem(uint256 shares, address receiver, address owner) → uint256 assets

Redeems exact shares for the equivalent assets.

  • Works even when paused
  • Automatically unstakes from strategy if needed

transfer(address to, uint256 amount) → bool

Transfers vault shares to another address.


transferFrom(address from, address to, uint256 amount) → bool

Transfers vault shares from one address to another (requires approval).


approve(address spender, uint256 amount) → bool

Approves another address to transfer your vault shares.


Reference

sf-contracts/src/SFVault.sol