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