DegenBox

The token Vault powering Abracadabra

Degenbox is an authorized fork of BentoBox (as Abracadabra purchased the licence for it). Cauldrons are built on top of both BentoBox and Degenbox, which allow users to reduce transaction fees as well as allow the creation of multiple strategies for the assets held inside.

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

Constructor

nonpayable

Parameters

Functions

View Functions

Write Functions


DOMAIN_SEPARATOR | view

Parameters

No parameters for this function.

Return values

balanceOf | view

mapping(IERC20 => mapping(address => uint256)) public balanceOf

Parameters

Return values

batch | payable

function batch(bytes[] calldata calls, bool revertOnFail) 
    external payable 
    returns (bool[] memory successes, bytes[] memory results) 

Parameters

Return values

batchFlashLoan | nonpayable

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

Parameters

Return values

No return values for this function.

claimOwnership | nonpayable

function claimOwnership() public 

Needs to be called by pendingOwner to claim ownership.

deploy | payable

function deploy(
    address masterContract,
    bytes calldata data,
    bool useCreate2
) public payable returns (address cloneAddress)

Deploys a given master Contract as a clone.

Parameters

Return values

deposit | payable

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

Parameters

Return values

flashLoan | nonpayable

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

Parameters

Return values

No return values for this function.

harvest | nonpayable

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

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

Parameters

Return values

No return values for this function.

masterContractApproved | view

mapping(address => mapping(address => bool)) public masterContractApproved;

masterContract to user to approval state, returns True if the user has approved the masterContract.

Parameters

Return values

masterContractOf | view

mapping(address => address) public masterContractOf;

Mapping from clone contracts to their masterContract.

Parameters

Return values

nonces | view

mapping(address => uint256) public nonces;

User nonces for masterContract approvals.

Parameters

Return values

owner | view

Owner of the DegenBox contract. Can perform actions that onlyOwner() can perform, such as strategy updates.

Parameters

No parameters for this function.

Return values

pendingOwner | view

When transferring ownership, the future owner is pending until they claims ownership.

Return values

pendingStrategy | view

Strategy change being submitted to a delay of 3 days, the setStrategy function is called twice, once to declare a strategy change, and another time after STRATEGY_DELAY (3 days). In between those calls, the new strategy is pendingStrategy.

Parameters

Return values

permitToken | nonpayable

function permitToken(
        IERC20 token,
        address from,
        address to,
        uint256 amount,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public

Parameters

Return values

No return values for this function.

registerProtocol | nonpayable

Parameters

No parameters for this function.

Return values

No return values for this function.

setMasterContractApproval | nonpayable

Parameters

Return values

No return values for this function.

setStrategy | nonpayable

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. A new strategy becomes pending first and can be activated once STRATEGY_DELAY is over. In the case of the Degenbox, STRATEGY_DELAY is 3 days.

Parameters

Return values

No return values for this function.

setStrategyTargetPercentage | nonpayable

function setStrategyTargetPercentage(
         IERC20 token, 
         uint64 targetPercentage_
      ) public onlyOwner {

Sets the target percentage of the strategy for token. It corresponds to the percentage of tokens deployed to the Strategy, vs kept in DegenBox.

Parameters

Return values

No return values for this function.

strategy | view

Returns the address of the Strategy mapped to the given ERC20 token.

Parameters

Return values

strategyData | view

Parameters

Return values

toAmount | view

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

Converts amounts of shares of a token into it's native representation.

Parameters

Return values

toShare | view

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

Converts amounts of a token in it's native representation into shares.

Parameters

Return values

totals | view

mapping(IERC20 => Rebase) public totals;

Keeps track of how many tokens are stored by DegenBox as well as how many shares are held by users.

Parameters

Return values

transfer | nonpayable

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

Transfer shares from a user account to another one.

Parameters

Return values

No return values for this function.

transferMultiple | nonpayable

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

Return values

No return values for this function.

transferOwnership | nonpayable

function transferOwnership(
    address newOwner,
    bool direct,
    bool renounce
) public onlyOwner 

Transfers ownership to newOwner. Either directly or claimable by the new pending owner. Can only be invoked by the current owner.

Parameters

Return values

No return values for this function.

whitelistMasterContract | nonpayable

function whitelistMasterContract(
    address masterContract, 
    bool approved
) public onlyOwner

Enables or disables a contract for approval without signed message.

Parameters

Return values

No return values for this function.

whitelistedMasterContracts | view

Returns True if a masterContract is whitelisted.

Parameters

Return values

withdraw | nonpayable

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

Return values

Events (for EVM logging)


LogDeploy

Parameters

LogDeposit

Parameters

LogFlashLoan

Parameters

LogRegisterProtocol

Parameters

LogSetMasterContractApproval

Parameters

LogStrategyDivest

Parameters

LogStrategyInvest

Parameters

LogStrategyLoss

Parameters

LogStrategyProfit

Parameters

LogStrategyQueued

Parameters

LogStrategySet

Parameters

LogStrategyTargetPercentage

Parameters

LogTransfer

Parameters

LogWhiteListMasterContract

Parameters

LogWithdraw

Parameters

OwnershipTransferred

Parameters

Last updated