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
Name | Type | Description |
---|---|---|
wethToken_ |
| address of WETH. |
Functions
View Functions
Write Functions
DOMAIN_SEPARATOR | view
DOMAIN_SEPARATOR | view
Parameters
No parameters for this function.
Return values
Name | Type |
---|---|
/ |
|
balanceOf | view
balanceOf | view
Parameters
Name | Type | Description |
---|---|---|
/ |
| Token to check |
/ |
| The address which balance is checked |
Return values
Name | Type | Description |
---|---|---|
/ |
| Shares of 'token' owned by 'address' |
batch | payable
batch | payable
Parameters
Name | Type | Description |
---|---|---|
calls |
| An array of inputs for each call. |
revertOnFail |
| If True then reverts after a failed call and stops doing further calls. |
Return values
Name | Type | Description |
---|---|---|
successes |
| An array indicating the success of a call, mapped one-to-one to |
results |
| An array with the returned data of each function call, mapped one-to-one to |
batchFlashLoan | nonpayable
batchFlashLoan | nonpayable
Parameters
Name | Type | Description |
---|---|---|
borrower |
| The address of the contract that implements and conforms to |
receivers |
| The address of the contract that implements and conforms to |
tokens |
| The addresses of the tokens. |
amounts |
| amounts of the tokens for each receiver. |
data |
| The calldata to pass to the |
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
Name | Type | Description |
---|---|---|
masterContract |
| The address of the contract to clone. |
data |
| Additional abi encoded calldata that is passed to the new clone via |
useCreate2 |
| Creates the clone by using the CREATE2 opcode, in this case |
Return values
Name | Type | Description |
---|---|---|
cloneAddress |
| Address of the created clone contract. |
deposit | payable
deposit | payable
Parameters
Name | Type | Description |
---|---|---|
token_ |
| The ERC-20 token to deposit. |
from |
| which account to pull the tokens from. |
to |
| which account to push the tokens to. |
amount |
| Token amount in native representation to deposit. |
share |
| Token amount represented in shares to deposit. Takes precedence over |
Return values
Name | Type | |
---|---|---|
amountOut |
| The amount deposited. |
shareOut |
| The deposited amount represented in shares. |
flashLoan | nonpayable
flashLoan | nonpayable
Parameters
Name | Type | |
---|---|---|
borrower |
| The address of the contract that implements and conforms to |
receiver |
| Address of the token receiver. |
token |
| The address of the token to receive. |
amount |
| Amount of the tokens to receive. |
data |
| The calldata to pass to the |
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
Name | Type | Description |
---|---|---|
token |
| The address of the token for which a strategy is deployed. |
balance |
| True if housekeeping should be done. |
maxChangeAmount |
| The maximum amount for either pulling or pushing from/to the |
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
Name | Type | Description |
---|---|---|
/ |
| Address of the masterContract. |
/ |
| Address of the user. |
Return values
Name | Type | Description |
---|---|---|
/ |
| Returns True if the masterContract is approved by user. |
masterContractOf | view
masterContractOf | view
Mapping from clone contracts to their masterContract.
Parameters
Name | Type | Description |
---|---|---|
/ |
| Address of the cloned contract. |
Return values
Name | Type | Description |
---|---|---|
/ |
| Address of the masterContract clone contract is cloned from. |
nonces | view
nonces | view
User nonces for masterContract approvals.
Parameters
Name | Type | Description |
---|---|---|
/ |
| User address. |
Return values
Name | Type | Description |
---|---|---|
/ |
| 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
Name | Type | Description |
---|---|---|
/ |
| Address of the Owner |
pendingOwner | view
pendingOwner | view
When transferring ownership, the future owner is pending until they claims ownership.
Return values
Name | Type | Description |
---|---|---|
/ |
| 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
Name | Type | Description |
---|---|---|
/ |
| The address of the token that maps to a strategy to change. |
Return values
Name | Type | Description |
---|---|---|
/ |
| The address of the contract that conforms to |
permitToken | nonpayable
permitToken | nonpayable
Parameters
Name | Type | |
---|---|---|
token |
| The ERC20 token that supports permit to call permit on. |
from |
| The token owner's address |
to |
| The token spender's address |
amount |
| The amount to be approved. |
deadline |
| Timestamp in the future until which permit can be called. |
v |
| v of the ECDSA signature. |
r |
| r of the ECDSA signature. |
s |
| 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
Name | Type |
---|---|
user |
|
masterContract |
|
approved |
|
v |
|
r |
|
s |
|
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
Name | Type | Description |
---|---|---|
token |
| The address of the token that maps to a strategy to change. |
newStrategy |
| The address of the contract that conforms to |
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
Name | Type | Description |
---|---|---|
token |
| The address of the token that maps to a strategy to change. |
targetPercentage_ |
| The new target in percent. Must be lesser or equal to |
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
Name | Type | Description |
---|---|---|
/ |
| The address of the token that maps to a strategy |
Return values
Name | Type | |
---|---|---|
/ |
| The address of the current strategy: a contract that conforms to |
strategyData | view
strategyData | view
Parameters
Name | Type | Description |
---|---|---|
/ |
| The address of the token that maps to a strategy |
Return values
Name | Type | Description |
---|---|---|
strategyStartDate |
| Timestamp of the strategy start date. |
targetPercentage |
| Current targetPercentage (% of funds wanted in strategy) of the token |
balance |
| Current balance held by strategy (before harvest) |
toAmount | view
toAmount | view
Converts amounts of shares of a token into it's native representation.
Parameters
Name | Type | Description |
---|---|---|
token |
| The ERC-20 token. |
share |
| The amount of shares. |
roundUp |
| If the result should be rounded up. |
Return values
Name | Type | Description |
---|---|---|
amount |
| The share amount back into native representation. |
toShare | view
toShare | view
Converts amounts of a token in it's native representation into shares.
Parameters
Name | Type | Description |
---|---|---|
token |
| The ERC-20 token. |
amount |
| The |
roundUp |
| If the result |
Return values
Name | Type | Description |
---|---|---|
share |
| 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
Name | Type | Description |
---|---|---|
/ |
| ERC20 Address which total we want. |
Return values
Name | Type | |
---|---|---|
elastic |
| How many tokens (in native representation) are deposited into DegenBox. |
base |
| How many shares of tokens are held by users. |
transfer | nonpayable
transfer | nonpayable
Transfer shares from a user account to another one.
Parameters
Name | Type | |
---|---|---|
token |
| The ERC20 token to transfer. |
from |
| The account to transfer |
to |
| The account to transfer |
share |
| 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
Name | Type | |
---|---|---|
token |
| The ERC20 token to transfer. |
from |
| The account to transfer |
tos |
| The accounts to transfer |
shares |
| The amount of |
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
Name | Type | Description |
---|---|---|
newOwner |
| Address of the new owner. |
direct |
| True if |
renounce |
| Allows the |
Return values
No return values for this function.
whitelistMasterContract | nonpayable
whitelistMasterContract | nonpayable
Enables or disables a contract for approval without signed message.
Parameters
Name | Type | Description |
---|---|---|
masterContract |
| masterContract which status is being changed. |
approved |
| New approval status. |
Return values
No return values for this function.
whitelistedMasterContracts | view
whitelistedMasterContracts | view
Returns True if a masterContract is whitelisted.
Parameters
Name | Type | Description |
---|---|---|
/ |
| Address of the masterContract. |
Return values
Name | Type | Description |
---|---|---|
/ |
| Whitelisting status. |
withdraw | nonpayable
withdraw | nonpayable
Withdraws an amount of token
from a user account.
Parameters
Name | Type | Description |
---|---|---|
token_ |
| The ERC-20 token to withdraw. |
from |
| From which user to pull the tokens. |
to |
| To which user to push the tokens. |
amount |
| Amount of tokens. Either one of |
share |
| Like above, but |
Return values
Name | Type | Description |
---|---|---|
amountOut |
| Amount of token withdrawn, in native representation. |
shareOut |
| Shares of token withdrawn. |
Events (for EVM logging)
LogDeploy
LogDeploy
Parameters
Name | Type | Indexed |
---|---|---|
masterContract |
|
|
data |
|
|
cloneAddress |
|
|
LogDeposit
LogDeposit
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
from |
|
|
to |
|
|
amount |
|
|
share |
|
|
LogFlashLoan
LogFlashLoan
Parameters
Name | Type | Indexed |
---|---|---|
borrower |
|
|
token |
|
|
amount |
|
|
feeAmount |
|
|
receiver |
|
|
LogRegisterProtocol
LogRegisterProtocol
Parameters
Name | Type | Indexed |
---|---|---|
protocol |
|
|
LogSetMasterContractApproval
LogSetMasterContractApproval
Parameters
Name | Type | Indexed |
---|---|---|
masterContract |
|
|
user |
|
|
approved |
|
|
LogStrategyDivest
LogStrategyDivest
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
amount |
|
|
LogStrategyInvest
LogStrategyInvest
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
amount |
|
|
LogStrategyLoss
LogStrategyLoss
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
amount |
|
|
LogStrategyProfit
LogStrategyProfit
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
amount |
|
|
LogStrategyQueued
LogStrategyQueued
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
strategy |
|
|
LogStrategySet
LogStrategySet
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
strategy |
|
|
LogStrategyTargetPercentage
LogStrategyTargetPercentage
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
targetPercentage |
|
|
LogTransfer
LogTransfer
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
from |
|
|
to |
|
|
share |
|
|
LogWhiteListMasterContract
LogWhiteListMasterContract
Parameters
Name | Type | Indexed |
---|---|---|
masterContract |
|
|
approved |
|
|
LogWithdraw
LogWithdraw
Parameters
Name | Type | Indexed |
---|---|---|
token |
|
|
from |
|
|
to |
|
|
amount |
|
|
share |
|
|
OwnershipTransferred
OwnershipTransferred
Parameters
Name | Type | Indexed |
---|---|---|
clopreviousOwner |
|
|
newOwner |
|
|
Last updated