Silo Facet

The Silo Facet handles Depositing, Withdrawing, and transferring Deposits (whitelisted assets in the Silo).

Stems keep track of when the Deposit was created. When the Deposit was created determines how much Grown Stalk per BDV the Deposit has.

Call Functions

function deposit(
    address token,
    uint256 _amount,
    LibTransfer.From mode
) 
    external 
    payable 
    nonReentrant 
    mowSender(token)
    returns (uint256 amount, uint256 bdv, int96 stem);

Deposits ERC20 token into internal Farmer balances.

function withdrawDeposit(
    address token,
    int96 stem,
    uint256 amount
    LibTransfer.To mode
) external payable mowSender(token) nonReentrant;

Withdraws a single Deposit.

function withdrawDeposits(
    address token,
    int96[] calldata stems,
    uint256[] calldata amounts,
    LibTransfer.To mode
) external payable mowSender(token) nonReentrant;

Withdraws multiple Deposits.

function transferDeposit(
    address sender,
    address recipient,
    address token,
    int96 stem,
    uint256 amount
) public payable nonReentrant returns (uint256 bdv);

Transfers single Farmer's Deposit.

function transferDeposits(
    address sender,
    address recipient,
    address token,
    int96[] calldata stem,
    uint256[] calldata amounts
) public payable nonReentrant returns (uint256[] memory bdvs);

Transfers multiple Farmer Deposits.

function safeTransferFrom(
    address sender, 
    address recipient, 
    uint256 depositId, 
    uint256 amount,
    bytes calldata
) external;

Transfer a single Deposit, conforming to the ERC1155 standard.

function safeBatchTransferFrom(
    address sender, 
    address recipient, 
    uint256[] calldata depositIds, 
    uint256[] calldata amounts, 
    bytes calldata
) external;

Transfer a single Deposit, conforming to the ERC1155 standard.

Yield Distribution

function mow(address account, address token) external payable;

Claim Grown Stalk for an account for a particular whitelisted asset.

function mowMultiple(address account, address[] calldata tokens) external payable;

Mow for multiple whitelisted assets for an account.

function plant() 
    external payable returns (uint256 beans, int96 stem);

Claim Earned Beans and their associated Stalk and Plantable Seeds for msg.sender.

function claimPlenty() external payable;

Claims rewards from a Flood (Season of Plenty) for msg.sender.

View Functions

Utilities

function lastUpdate(address account) public view returns (uint32);

Get the last Season in which account updated their Silo.

Silo Totals

function totalStalk() public view returns (uint256);

Returns the total supply of Stalk. Does NOT include Grown Stalk.

function totalRoots() public view returns (uint256);

Returns the total supply of Roots.

function totalEarnedBeans() public view returns (uint256);

Returns the total supply of Earned Beans.

Silo Account Balances

function balanceOfStalk(address account) public view returns (uint256);

Returns the balance of Stalk for a particular Farmer. Does NOT include Grown Stalk; does include Earned Stalk.

function balanceOfRoots(address account) public view returns (uint256);

Returns the balance of Roots for a particular Farmer.

function balanceOfGrownStalk(address account, address token)
    public
    view
    returns (uint256);

Returns the balance of Grown Stalk for account. Grown Stalk is earned each Season from BDV and must be Mown to add it to a user's Stalk balance.

function grownStalkForDeposit(
    address account,
    address token,
    int96 stem
)
    public
    view
    returns (uint grownStalk);

Returns the balance of Grown Stalk for a single deposit of token in stem for account.

function balanceOfEarnedBeans(address account)
    public
    view
    returns (uint256 beans);

Returns the balance of Earned Beans for a Farmer.

function balanceOfEarnedStalk(address account)
    public
    view
    returns (uint256)

Return the account balance of Earned Stalk, the Stalk associated with Earned Beans.

function balanceOfDepositedBdv(address account, address token)
    external
    view
    returns (uint256 depositedBdv);

Return the balance of Deposited BDV of a whitelisted asset for a given Farmer.

function getLastMowedStem(address account, address token)
    external
    view
    returns (int96 lastStem);

Return the Stem at the time that a Farmer last Mowed a particular whitelisted asset.

function getMowStatus(address account, address token)
    external
    view
    returns (Account.MowStatus memory mowStatus);

Return the Mow Status struct of token for a given account.

Season of Plenty (Flood)

function lastSeasonOfPlenty() public view returns (uint32);

Returns the last Season that a Season of Plenty started.

function balanceOfPlenty(address account)
    public
    view
    returns (uint256 plenty);

Returns the Farmer's balance of unclaimed 3CRV earned from the Season of Plenty.

function balanceOfRainRoots(address account) public view returns (uint256);

Returns the account balance of Roots the last time it was Raining during a Silo update.

function balanceOfSop(address account)
    external
    view
    returns (AccountSeasonOfPlenty memory sop);

Returns the account Season of Plenty related state variables.

Stems

function stemTipForToken(address token)
    public
    view
    returns (int96 _stemTip);

Returns the "stemTip", or cumulative Grown Stalk Per BDV of a given Deposited asset since whitelist, for a given whitelisted token.

function seasonToStem(address token, uint32 season)
    public
    view
    returns (int96 stem);

Get the Stem associated with a particular Deposit (via its token and Season). Kept for legacy reasons.

function getSeedsPerToken(address token) public view virtual returns (uint256);

Gets the Seeds per token for legacy whitelisted assets. Calling with an non-legacy token will return 0, even after the token is whitelisted. Kept for legacy reasons.

function stemStartSeason() public view virtual returns (uint16);

Returns the Season in which Beanstalk initialized Silo V3, i.e., the Season in which Stems were initialized.

function migrationNeeded(address account) public view returns (bool);

Returns whether or not a Farmer needs to migrate to Silo V3.

function inVestingPeriod() public view returns (bool);

Returns if Earned Beans from the previous gm call are still vesting. Vesting Earned Beans cannot be received via plant until the Vesting Period is over, and will be forfeited if a Farmer Withdraws during the Vesting Period.

Getters

function getDeposit(
    address account,
    address token,
    int96 stem
) external view returns (uint256, uint256)

Find the amount and BDV of token that a Farmer has Deposited in a given Stem.

function getTotalDeposited(address token) external view returns (uint256);

Get the total amount of token currently Deposited in the Silo across all Farmers.

function getTotalDepositedBdv(address token) external view returns (uint256);

Get the total BDV of token currently Deposited in the Silo across all Farmers.

function tokenSettings(address token)
    external
    view
    returns (Storage.SiloSettings memory);

Get the Storage.SiloSettings for a whitelisted token.

function bdv(address token, uint256 amount)
    external
    view
    returns (uint256 _bdv);

Returns the total BDV of a number of tokens on the Deposit Whitelist.

ERC-1155

function balanceOf(
    address account, 
    uint256 depositId
) external view returns (uint256 amount);

Gets the amount of tokens in a Deposit type for a given Farmer.

function balanceOfBatch(
    address[] calldata accounts, 
    uint256[] calldata depositIds
) external view returns (uint256[] memory);

Gets an array of amounts corresponding to Deposits.

function getDepositId(
    address token, 
    int96 stem
) external pure returns (uint256);

Gets the Deposit ID given an whitelisted token address and Stem.

Events

event Plant(
    address indexed account,
    uint256 beans
);

Emitted when the deposit associated with the Earned Beans of account are Planted.

event ClaimPlenty(
    address indexed account,
    uint256 plenty
);

Emitted when 3CRV paid to account during a Flood is claimed.

event StalkBalanceChanged(
    address indexed account,
    int256 delta,
    int256 deltaRoots
);

Emitted when account gains or loses Stalk.

event AddDeposit(
    address indexed account,
    address indexed token,
    int96 stem,
    uint256 amount,
    uint256 bdv
);

Emitted when account adds a single Deposit to the Silo. There is no AddDeposits event because there is currently no operation in which Beanstalk creates multiple Deposits in different Stems.

event RemoveDeposit(
    address indexed account,
    address indexed token,
    int96 stem,
    uint256 amount,
    uint256 bdv
);

Emitted when account removes a single Deposit from the Silo. Occurs during Withdraw and Convert.

event RemoveDeposits(
    address indexed account,
    address indexed token,
    int96[] stems,
    uint256[] amounts,
    uint256 amount,
    uint256[] bdvs
);

Emitted when account removes multiple Deposits from the Silo. Occurs during Withdraw and Convert.

event TransferSingle(
    address indexed operator,
    address indexed from,
    address indexed to,
    uint256 id,
    uint256 value
);

ERC-1155 event. Emitted when a Deposit is created, removed, or transferred.

event TransferBatch(
    address indexed operator,
    address indexed from,
    address indexed to,
    uint256[] ids,
    uint256[] values
);

ERC-1155 event. Emitted when multiple deposits are withdrawn or transferred.

event RemoveWithdrawals(
    address indexed account,
    address indexed token,
    uint32[] seasons,
    uint256 amount
);

Legacy event. This event is kept for backwards compatibility in order for the ABI to generate properly.

event RemoveWithdrawal(
    address indexed account,
    address indexed token,
    uint32 season,
    uint256 amount
);

Legacy event. This event is kept for backwards compatibility in order for the ABI to generate properly.

Last updated