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
Constructor
nonpayable
nonpayable
Parameters
wethToken_
address
address of WETH.
Functions
View Functions
Write Functions
DOMAIN_SEPARATOR | view
DOMAIN_SEPARATOR | view
Parameters
No parameters for this function.
Return values
/
bytes32
balanceOf | view
balanceOf | view
Parameters
/
address
Token to check
/
address
The address which balance is checked
Return values
/
uint256
Shares of 'token' owned by 'address'
batch | payable
batch | payable
Parameters
calls
bytes[]
An array of inputs for each call.
revertOnFail
bool
If True then reverts after a failed call and stops doing further calls.
Return values
successes
bool[]
An array indicating the success of a call, mapped one-to-one to calls
.
results
bytes[]
An array with the returned data of each function call, mapped one-to-one to calls
.
batchFlashLoan | nonpayable
batchFlashLoan | nonpayable
Parameters
borrower
address
The address of the contract that implements and conforms to IBatchFlashBorrower
and handles the flashloan.
receivers
address[]
The address of the contract that implements and conforms to IBatchFlashBorrower
and handles the flashloan.
tokens
address[]
The addresses of the tokens.
amounts
uint256[]
amounts of the tokens for each receiver.
data
bytes
The calldata to pass to the borrower
contract.
Return values
No return values for this function.
claimOwnership | nonpayable
claimOwnership | nonpayable
Needs to be called by pendingOwner
to claim ownership.
deploy | payable
deploy | payable
Deploys a given master Contract as a clone.
Parameters
masterContract
address
The address of the contract to clone.
data
bytes
Additional abi encoded calldata that is passed to the new clone via IMasterContract.init
.
useCreate2
bool
Creates the clone by using the CREATE2 opcode, in this case data
will be used as salt.
Return values
cloneAddress
address
Address of the created clone contract.
deposit | payable
deposit | payable
Parameters
token_
address
The ERC-20 token to deposit.
from
address
which account to pull the tokens from.
to
address
which 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 precedence over amount
.
Return values
amountOut
uint256
The amount deposited.
shareOut
uint256
The deposited amount represented in shares.
flashLoan | nonpayable
flashLoan | nonpayable
Parameters
borrower
address
The address of the contract that implements and conforms to IFlashBorrower
and handles the flashloan.
receiver
address
Address of the token receiver.
token
address
The address of the token to receive.
amount
uint256
Amount of the tokens to receive.
data
bytes
The calldata to pass to the borrower
contract.
Return values
No return values for this function.
harvest | nonpayable
harvest | nonpayable
The actual process of yield farming. Executes the strategy of token
. Optionally does housekeeping if balance
is true.
Parameters
token
address
The address of the 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.
Return values
No return values for this function.
masterContractApproved | view
masterContractApproved | view
masterContract to user to approval state, returns True if the user has approved the masterContract.
Parameters
/
address
Address of the masterContract.
/
address
Address of the user.
Return values
/
bool
Returns True if the masterContract is approved by user.
masterContractOf | view
masterContractOf | view
Mapping from clone contracts to their masterContract.
Parameters
/
address
Address of the cloned contract.
Return values
/
address
Address of the masterContract clone contract is cloned from.
nonces | view
nonces | view
User nonces for masterContract approvals.
Parameters
/
address
User address.
Return values
/
uint256
Nonce of the user.
owner | view
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
/
address
Address of the Owner
pendingOwner | view
pendingOwner | view
When transferring ownership, the future owner is pending until they claims ownership.
Return values
/
address
Address of the pending owner.
pendingStrategy | view
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
/
address
The address of the token that maps to a strategy to change.
Return values
/
address
The address of the contract that conforms to IStrategy
.
permitToken | nonpayable
permitToken | nonpayable
Parameters
token
address
The ERC20 token that supports permit to call permit on.
from
address
The token owner's address
to
address
The token spender's address
amount
uint256
The amount to be approved.
deadline
uint256
Timestamp in the future until which permit can be called.
v
uint8
v of the ECDSA signature.
r
bytes32
r of the ECDSA signature.
s
bytes32
s of the ECDSA signature.
Return values
No return values for this function.
registerProtocol | nonpayable
registerProtocol | nonpayable
Parameters
No parameters for this function.
Return values
No return values for this function.
setMasterContractApproval | nonpayable
setMasterContractApproval | nonpayable
Parameters
user
address
masterContract
address
approved
bool
v
uint8
r
bytes32
s
bytes32
Return values
No return values for this function.
setStrategy | nonpayable
setStrategy | nonpayable
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
token
address
The address of the token that maps to a strategy to change.
newStrategy
address
The address of the contract that conforms to IStrategy
.
Return values
No return values for this function.
setStrategyTargetPercentage | nonpayable
setStrategyTargetPercentage | nonpayable
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
token
address
The address of the token that maps to a strategy to change.
targetPercentage_
uint64
The new target in percent. Must be lesser or equal to MAX_TARGET_PERCENTAGE
.
Return values
No return values for this function.
strategy | view
strategy | view
Returns the address of the Strategy mapped to the given ERC20 token.
Parameters
/
address
The address of the token that maps to a strategy
Return values
/
address
The address of the current strategy: a contract that conforms to IStrategy
.
strategyData | view
strategyData | view
Parameters
/
address
The address of the token that maps to a strategy
Return values
strategyStartDate
uint64
Timestamp of the strategy start date.
targetPercentage
uint64
Current targetPercentage (% of funds wanted in strategy) of the token
balance
uint128
Current balance held by strategy (before harvest)
toAmount | view
toAmount | view
Converts amounts of shares of a token into it's native representation.
Parameters
token
address
The ERC-20 token.
share
uint256
The amount of shares.
roundUp
bool
If the result should be rounded up.
Return values
amount
uint256
The share amount back into native representation.
toShare | view
toShare | view
Converts amounts of a token in it's native representation into shares.
Parameters
token
address
The ERC-20 token.
amount
uint256
The token
amount.
roundUp
bool
If the result share
should be rounded up.
Return values
share
uint256
The token amount represented in shares.
totals | view
totals | view
Keeps track of how many tokens are stored by DegenBox as well as how many shares are held by users.
Parameters
/
address
ERC20 Address which total we want.
Return values
elastic
uint128
How many tokens (in native representation) are deposited into DegenBox.
base
uint128
How many shares of tokens are held by users.
transfer | nonpayable
transfer | nonpayable
Transfer shares from a user account to another one.
Parameters
token
address
The ERC20 token to transfer.
from
address
The account to transfer token
from.
to
address
The account to transfer token
to.
share
uint256
The amount of shares to transfer.
Return values
No return values for this function.
transferMultiple | nonpayable
transferMultiple | nonpayable
Transfer shares from a user account to multiple other ones.
Parameters
token
address
The ERC20 token to transfer.
from
address
The account to transfer token
from.
tos
address[]
The accounts to transfer token
to.
shares
uint256[]
The amount of token
in shares for each receiver in tos
.
Return values
No return values for this function.
transferOwnership | nonpayable
transferOwnership | nonpayable
Transfers ownership to newOwner
. Either directly or claimable by the new pending owner. Can only be invoked by the current owner
.
Parameters
newOwner
address
Address of the new owner.
direct
bool
True if newOwner
should be set immediately. False if newOwner
needs to use claimOwnership
.
renounce
bool
Allows the newOwner
to be address(0)
if direct
and renounce
is True. Has no effect otherwise.
Return values
No return values for this function.
whitelistMasterContract | nonpayable
whitelistMasterContract | nonpayable
Enables or disables a contract for approval without signed message.
Parameters
masterContract
address
masterContract which status is being changed.
approved
bool
New approval status.
Return values
No return values for this function.
whitelistedMasterContracts | view
whitelistedMasterContracts | view
Returns True if a masterContract is whitelisted.
Parameters
/
address
Address of the masterContract.
Return values
/
bool
Whitelisting status.
withdraw | nonpayable
withdraw | nonpayable
Withdraws an amount of token
from a user account.
Parameters
token_
address
The ERC-20 token to withdraw.
from
address
From which user to pull the tokens.
to
address
To which user to push the tokens.
amount
uint256
Amount of tokens. Either one of amount
or share
needs to be supplied.
share
uint256
Like above, but share
takes precedence over amount
.
Return values
amountOut
uint256
Amount of token withdrawn, in native representation.
shareOut
uint256
Shares of token withdrawn.
Events (for EVM logging)
LogDeploy
LogDeploy
Parameters
masterContract
address
true
data
bytes
false
cloneAddress
address
true
LogDeposit
LogDeposit
Parameters
token
address
true
from
address
true
to
address
true
amount
uint256
false
share
uint256
false
LogFlashLoan
LogFlashLoan
Parameters
borrower
address
true
token
address
true
amount
uint256
false
feeAmount
uint256
false
receiver
address
true
LogRegisterProtocol
LogRegisterProtocol
Parameters
protocol
address
true
LogSetMasterContractApproval
LogSetMasterContractApproval
Parameters
masterContract
address
true
user
address
true
approved
bool
false
LogStrategyDivest
LogStrategyDivest
Parameters
token
address
true
amount
uint256
false
LogStrategyInvest
LogStrategyInvest
Parameters
token
address
true
amount
uint256
false
LogStrategyLoss
LogStrategyLoss
Parameters
token
address
true
amount
uint256
false
LogStrategyProfit
LogStrategyProfit
Parameters
token
address
true
amount
uint256
false
LogStrategyQueued
LogStrategyQueued
Parameters
token
address
true
strategy
address
true
LogStrategySet
LogStrategySet
Parameters
token
address
true
strategy
address
true
LogStrategyTargetPercentage
LogStrategyTargetPercentage
Parameters
token
address
true
targetPercentage
uint256
false
LogTransfer
LogTransfer
Parameters
token
address
true
from
address
true
to
address
true
share
uint256
false
LogWhiteListMasterContract
LogWhiteListMasterContract
Parameters
masterContract
address
true
approved
bool
false
LogWithdraw
LogWithdraw
Parameters
token
address
true
from
address
true
to
address
true
amount
uint256
false
share
uint256
false
OwnershipTransferred
OwnershipTransferred
Parameters
clopreviousOwner
address
true
newOwner
address
true
Last updated