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
Internal function that returns the balance of token
this contract holds, plus the total amount this contract thinks the strategy holds.
Parameters
token
IERC20
address of ERC20 token to represent
toShare
Helper function to represent an amount of token in shares.
Parameters
token
IERC20
address of ERC20 token to represent
amount
uint256
amount of aforementioned ERC20 token
roundUp
bool
if the result share should be rounded up
toAmount
Helper function to represent shares back into token amount.
Parameters
token
IERC20
address of ERC20 token to represent
share
uint256
amount of shares
roundUp
bool
if the result amount should be rounded up
deposit
Deposit an amount of token represented in either amount or share.
Parameters
token
IERC20
address of ERC20 token to deposit
from
address
address of account to pull the tokens from
to
address
address of account to push the tokens to
amount
uint256
token amount in native representation to deposit
share
uint256
token amount represented in shares to deposit, takes precendence over amount
Returns
amountOut
uint256
amount deposited
shareOut
uint256
deposited amount represented in shares
withdraw
Withdraws an amount of token from a user account.
Parameters
token
IERC20
address of ERC20 token to withdraw
from
address
address of account to pull the tokens from
to
address
address of account to push the tokens to
amount
uint256
token amount in native representation to deposit (must supply amount
or share
)
share
uint256
token amount represented in shares to deposit, takes precendence over amount
Returns
amountOut
uint256
amount withdrawn
shareOut
uint256
withdrawn amount represented in shares
transfer
Transfer shares from a user account to another one.
Parameters
token
IERC20
address of ERC20 token to transfer
from
address
address of account to pull the tokens from
to
address
address of account to push the tokens to
share
uint256
token amount represented in shares
transferMultiple
Transfer shares from a user account to multiple other ones.
Parameters
token
IERC20
address of ERC20 token to transfer
from
address
address of account to pull the tokens from
tos
address[] calldata
addresses of the receivers of the tokens
shares
uint256[] calldata
token amount represented in shares for each receiver in tos
flashLoan
Provides flash loan capabilities.
Parameters
borrower
IFlashBorrower
the address of the contract that implements and conforms to IFlashBorrower
and handles the flashloan
receiver
address
address of the token receiver
token
IERC20
address of the token to receive
amount
uint256
amount of tokens to receive
data
bytes
the calldata to pass to the borrower
contract
batchFlashLoan
Support for batched flashloans; useful to request multiple different tokens in a single transaction.
Parameters
borrower
IBatchFlashBorrower
the address of the contract that implements and conforms to IBatchFlashBorrower
and handles the flashloan
receivers
address[]
array of addresses of the token receivers
tokens
IERC20[]
addresses of the tokens
amounts
uint256[]
amounts of the tokens for each receiver
data
bytes
the calldata to pass to the borrower
contract
setStrategyTargetPercentage
Sets the target percentage of the strategy for token
. Can only be called by the owner of the contract.
Parameters
token
IERC20
address of ERC20 token that maps to a strategy to change
targetPercentage_
uint64
the new target in percent, must be lesser or equal to MAX_TARGET_PERCENTAGE
setStrategy
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
token
IERC20
address of ERC20 token that maps to a strategy to change
newStrategy
IStrategy
address of the contract that conforms to IStrategy
harvest
Executes the strategy of token
- ie, the actual process of yield farming. Optionally does housekeeping if balance
is true.
Parameters
token
IERC20
address of ERC20 token for which a strategy is deployed
balance
bool
true if housekeeping should be done
maxChangeAmount
uint256
the maximum amount for either pulling or pushing from/to the IStrategy
contract
Last updated