BentoBox

Sushi's instance of the bentoBox, owned by the Sushi Multisig.

BentoBox

The BentoBox is a vault for tokens. The stored tokens can be flashloaned or used in strategies - the yield from this will go to the token depositors.

You can find the full contract here.

Warning: Rebasing tokens are NOT supported and WILL cause a loss of funds!

Please do not send funds directly to either BentoBox or Degenbox as they will be lost! Use the "Deposit" function instead!

Functions

_tokenBalanceOf

function _tokenBalanceOf(IERC20 token) internal view returns (uint256 amount)

Internal function that returns the balance of token this contract holds, plus the total amount this contract thinks the strategy holds.

Parameters

toShare

function toShare(
        IERC20 token,
        uint256 amount,
        bool roundUp
    ) external view returns (uint256 share)

Helper function to represent an amount of token in shares.

Parameters

toAmount

function toAmount(
        IERC20 token,
        uint256 share,
        bool roundUp
    ) external view returns (uint256 amount)

Helper function to represent shares back into token amount.

Parameters

deposit

function deposit(
        IERC20 token_,
        address from,
        address to,
        uint256 amount,
        uint256 share
    ) public payable allowed(from) returns (uint256 amountOut, uint256 shareOut)

Deposit an amount of token represented in either amount or share.

Parameters

Returns

withdraw

 function withdraw(
        IERC20 token_,
        address from,
        address to,
        uint256 amount,
        uint256 share
    ) public allowed(from) returns (uint256 amountOut, uint256 shareOut)

Withdraws an amount of token from a user account.

Parameters

Returns

transfer

 function transfer(
        IERC20 token,
        address from,
        address to,
        uint256 share
    ) public allowed(from)

Transfer shares from a user account to another one.

Parameters

transferMultiple

function transferMultiple(
        IERC20 token,
        address from,
        address[] calldata tos,
        uint256[] calldata shares
    ) public allowed(from)

Transfer shares from a user account to multiple other ones.

Parameters

flashLoan

function flashLoan(
        IFlashBorrower borrower,
        address receiver,
        IERC20 token,
        uint256 amount,
        bytes calldata data
    ) public

Provides flash loan capabilities.

Parameters

batchFlashLoan

 function batchFlashLoan(
        IBatchFlashBorrower borrower,
        address[] calldata receivers,
        IERC20[] calldata tokens,
        uint256[] calldata amounts,
        bytes calldata data
    ) public

Support for batched flashloans; useful to request multiple different tokens in a single transaction.

Parameters

setStrategyTargetPercentage

function setStrategyTargetPercentage(IERC20 token, uint64 targetPercentage_) public onlyOwner

Sets the target percentage of the strategy for token. Can only be called by the owner of the contract.

Parameters

setStrategy

function setStrategy(IERC20 token, IStrategy newStrategy) public onlyOwner

Sets the contract address of a new strategy that conforms to IStrategy for token (must be called twice with the same arguments). Can only be called by the owner of the contract.

Parameters

harvest

function harvest(
        IERC20 token,
        bool balance,
        uint256 maxChangeAmount
    ) public

Executes the strategy of token - ie, the actual process of yield farming. Optionally does housekeeping if balance is true.

Parameters

Last updated