Interface

BentoBox

The BentoBox is a vault for tokens. The stored tokens can be flash loaned and used in strategies. Yield from this will go to the token depositors. Rebasing tokens ARE NOT supported and WILL cause loss of funds. Any funds transferred directly onto the BentoBox will be lost, use the deposit function instead.

constructor nonpayable (address)

  • Parameters

  • address wethToken_

receive payable ()

Events

LogDeploy (address,bytes,address)

  • Parameters

  • address masterContract

  • bytes data

  • address cloneAddress

Logs the deployment of a clone contract through the deploy method.

LogDeposit (address,address,address,uint256,uint256)

  • Parameters

  • address token

  • address from

  • address to

  • uint256 amount

  • uint256 share

Logs the deposit of funds.

LogFlashLoan (address,address,uint256,uint256,address)

  • Parameters

  • address borrower

  • address token

  • uint256 amount

  • uint256 feeAmount

  • address receiver

Logs a FlashLoan executed against the BentoBox.

LogRegisterProtocol (address)

  • Parameters

  • address protocol

Logs a contract being registered as a protocol that allows it to be used within the approval system without being a clone contract.

LogSetMasterContractApproval (address,address,bool)

  • Parameters

  • address masterContract

  • address user

  • bool approved

LogStrategyDivest (address,uint256)

  • Parameters

  • address token

  • uint256 amount

LogStrategyInvest (address,uint256)

  • Parameters

  • address token

  • uint256 amount

LogStrategyLoss (address,uint256)

  • Parameters

  • address token

  • uint256 amount

LogStrategyProfit (address,uint256)

  • Parameters

  • address token

  • uint256 amount

LogStrategyQueued (address,address)

  • Parameters

  • address token

  • address strategy

LogStrategySet (address,address)

  • Parameters

  • address token

  • address strategy

LogStrategyTargetPercentage (address,uint256)

  • Parameters

  • address token

  • uint256 targetPercentage

LogTransfer (address,address,address,uint256)

  • Parameters

  • address token

  • address from

  • address to

  • uint256 share

LogWhiteListMasterContract (address,bool)

  • Parameters

  • address masterContract

  • bool approved

LogWithdraw (address,address,address,uint256,uint256)

  • Parameters

  • address token

  • address from

  • address to

  • uint256 amount

  • uint256 share

OwnershipTransferred (address,address)

  • Parameters

  • address previousOwner

  • address newOwner

Methods

BentoBox

balanceOf view (address,address)

  • Parameters

  • address _0

  • address _1

  • Return Values

  • uint256 _0

Returns the shares an account holds of a certain token.

batchFlashLoan nonpayable (address,address[],address[],uint256[],bytes)

Support for batched flashloans. Useful to request multiple different `tokens` in a single transaction.

  • Parameters

  • address borrower: The address of the contract that implements and conforms to `IBatchFlashBorrower` and handles the flashloan.

  • address[] receivers: An array of the token receivers. A one-to-one mapping with `tokens` and `amounts`.

  • address[] tokens: The addresses of the tokens.

  • uint256[] amounts: of the tokens for each receiver.

  • bytes data: The calldata to pass to the `borrower` contract.

deposit payable (address,address,address,uint256,uint256)

Deposit an amount of token represented in either amount or share. The deposit function is used to add a BentoBox balance for a token to an address (user or contract). This can be done in 2 ways:

  • pulling in approved tokens using transferFrom

  • transfer the tokens onto the BentoBox contract address and use the BentoBox contract address to 'skim' the tokens to the 'to' address.

  • Parameters

  • address token_: The ERC-20 token to deposit.

  • address from: which account to pull the tokens.

  • address to: which account to push the tokens.

  • uint256 amount: Token amount in native representation to deposit.

  • uint256 share: Token amount represented in shares to deposit. Takes precedence over `amount`.

  • Return Values

  • uint256 amountOut: The amount deposited.

  • uint256 shareOut: The deposited amount represented in shares.

When the amount is calculated from the share and converting the amount back to share results in less, amount is increased by 1. This is effectively rounding up instead of down, to ensure the amount being added at a minimum matches the value of the shares given.

flashLoan nonpayable (address,address,address,uint256,bytes)

Flashloan ability.

  • Parameters

  • address borrower: The address of the contract that implements and conforms to `IFlashBorrower` and handles the flashloan.

  • address receiver: Address of the token receiver.

  • address token: The address of the token to receive.

  • uint256 amount: of the tokens to receive.

  • bytes data: The calldata to pass to the `borrower` contract.

harvest nonpayable (address,bool,uint256)

The actual process of yield farming. Executes the strategy of `token`. Optionally does housekeeping if `balance` is true. `maxChangeAmount` is relevant for skimming or withdrawing if `balance` is true.

  • Parameters

  • address token: The address of the token for which a strategy is deployed.

  • bool balance: True if housekeeping should be done.

  • uint256 maxChangeAmount: The maximum amount for either pulling or pushing from/to the `IStrategy` contract.

pendingStrategy view (address)

  • Parameters

  • address _0

  • Return Values

  • address _0

setStrategy nonpayable (address,address)

Sets the contract address of a new strategy that conforms to `IStrategy` for `token`. Must be called twice with the same arguments. A new strategy becomes pending first and can be activated once `STRATEGY_DELAY` is over.

Only the owner of this contract is allowed to change this.

  • Parameters

  • address token: The address of the token that maps to a strategy to change.

  • address newStrategy: The address of the contract that conforms to `IStrategy`.

setStrategyTargetPercentage nonpayable (address,uint64)

Sets the target percentage of the strategy for `token`.

Only the owner of this contract is allowed to change this.

  • Parameters

  • address token: The address of the token that maps to a strategy to change.

  • uint64 targetPercentage_: The new target in percent. Must be lesser or equal to `MAX_TARGET_PERCENTAGE`.

strategy view (address)

  • Parameters

  • address _0

  • Return Values

  • address _0

strategyData view (address)

  • Parameters

  • address _0

  • Return Values

  • uint64 strategyStartDate

  • uint64 targetPercentage

  • uint128 balance

toAmount view (address,uint256,bool)

Helper function represent shares back into the `token` amount.

  • Parameters

  • address token: The ERC-20 token.

  • uint256 share: The amount of shares.

  • bool roundUp: If the result should be rounded up.

  • Return Values

  • uint256 amount: The share amount back into native representation.

toShare view (address,uint256,bool)

Helper function to represent an `amount` of `token` in shares.

  • Parameters

  • address token: The ERC-20 token.

  • uint256 amount: The `token` amount.

  • bool roundUp: If the result `share` should be rounded up.

  • Return Values

  • uint256 share: The token amount represented in shares.

totals view (address)

  • Parameters

  • address _0

  • Return Values

  • uint128 elastic

  • uint128 base

transfer nonpayable (address,address,address,uint256)

Transfer shares from a user account to another one.

  • Parameters

  • address token: The ERC-20 token to transfer.

  • address from: which user to pull the tokens.

  • address to: which user to push the tokens.

  • uint256 share: The amount of `token` in shares.

transferMultiple nonpayable (address,address,address[],uint256[])

Transfer shares from a user account to multiple other ones.

  • Parameters

  • address token: The ERC-20 token to transfer.

  • address from: which user to pull the tokens.

  • address[] tos: The receivers of the tokens.

  • uint256[] shares: The amount of `token` in shares for each receiver in `tos`.

withdraw nonpayable (address,address,address,uint256,uint256)

Withdraws an amount of `token` from a user account.

  • Parameters

  • address token_: The ERC-20 token to withdraw.

  • address from: which user to pull the tokens.

  • address to: which user to push the tokens.

  • uint256 amount: of tokens. Either one of `amount` or `share` needs to be supplied.

  • uint256 share: Like above, but `share` takes precedence over `amount`.

  • Return Values

  • uint256 amountOut

  • uint256 shareOut

MasterContractManager

masterContractApproved view (address,address)

  • Parameters

  • address _0

  • address _1

  • Return Values

  • bool _0

View function that returns whether a user has approved a master contract.

masterContractOf view (address)

  • Parameters

  • address _0

  • Return Values

  • address _0

Returns the master contract for a given clone.

nonces view (address)

  • Parameters

  • address _0

  • Return Values

  • uint256 _0

Returns the nonce for a user which is needed to use the setMasterContractApproval function without the fallback.

registerProtocol nonpayable ()

setMasterContractApproval nonpayable (address,address,bool,uint8,bytes32,bytes32)

  • Parameters

  • address user

  • address masterContract

  • bool approved

  • uint8 v

  • bytes32 r

  • bytes32 s

whitelistMasterContract nonpayable (address,bool) onlyOwner

  • Parameters

  • address masterContract

  • bool approved

Allows the owner of the BentoBox to whitelist master contracts to be approved using the fallback. Before control is handed over to a multi protocol multisig, the Sushi OPS multisig is in control.

whitelistedMasterContracts view (address)

  • Parameters

  • address _0

  • Return Values

  • bool _0

Allows to check whether a given master contract is white listed.

BoringFactory

deploy payable (address,bytes,bool)

  • Parameters

  • address masterContract

  • bytes data

  • bool useCreate2

Allows the creation of clone contracts using either create or create2. For create2 the hash of the data will be used as the salt. The init function will be called on the MasterContract with data.

BoringBatchable

batch payable (bytes[],bool)

  • Parameters

  • bytes[] calls

  • bool revertOnFail

  • Return Values

  • bool[] successes

  • bytes[] results

The batch method as part of BoringBatchable allows methods to be combined into a single contract calls.

permitToken nonpayable (address,address,address,uint256,uint256,uint8,bytes32,bytes32)

  • Parameters

  • address token

  • address from

  • address to

  • uint256 amount

  • uint256 deadline

  • uint8 v

  • bytes32 r

  • bytes32 s

BoringOwnable

claimOwnership nonpayable ()

Allows a new owner to accept ownership over the vault.

owner view ()

  • Return Values

  • address _0

Returns the owner of the contract.

transferOwnership nonpayable (address,bool,bool)

  • Parameters

  • address newOwner

  • bool direct

  • bool renounce

pendingOwner view ()

  • Return Values

  • address _0