Garden
Last updated
Last updated
Interface: IGarden.sol
Gardens are fully composable (ERC-20). That means all the ERC-20 functions are available.
You can see all of them here.
The following functions can be called by public roles.
Anyone can call this function for public gardens. In case of private gardens the user requires specific permissions to deposit.
This function allow a user to deposit the _amountIn
of reserve asset into the garden.
Parameter | Description |
---|---|
Only garden members: Any garden member can call this function.
This function withdraws the reserve asset based on the garden tokens passed as _amountIn
in the garden and sends it back to the _to
address.
Only garden members: Any garden member can call this function.
This function allows a user to claim the rewards from the strategies that were active while the user was a member of the garden.
It must include all finalized strategies since the last claim.
Only garden members: Any garden member can call this function.
This function allows a user to claim the rewards from the strategies that executed while a member of the garden and stakes these rewards into the Heart Garden.
Any garden member can call this function.
This function allows any garden member to claim a garden NFT.
Only a garden creator can call this function.
The function makes public a previously private garden.
Only a garden creator can call this function.
The function allows a garden creator to transfer his creator rights to another account. The original creator can also renounce its creator role by assigning it to address(0) in public gardens.
Only the original garden creator can call this function.
The function adds extra creators. Can only be called if all the addresses in the extra-creators array are zero (0x).
Only a garden creator can call this function.
This function allows the creator to reset the garden hardlock for all users.
Only Governance or team multi-sig can call this function.
The function can update garden owners (original owner and extra creators) only if the original creator renounced (creator == address(0)).
Only a garden creator can call this function.
The function gives the right to create strategies and/or voting power to garden users in a public garden.
Only a garden creator can call this function.
The function allows a garden holding a governance token to delegate its voting power into a delegatee.
Only a garden creator can call this function.
The function updates relevant garden params.
Definition of the garden parameters:
Only a strategist of a garden can call this function.
This function creates a new strategy calling the factory and adds it to the array.
Definition of the strategy parameters:
Definition of operation types (opTypes):
Integration addresses can be found in the deployments section.
Only the strategist can call this function.
The function removes an expired candidate strategy from the strategy array.
The following functions can only be executed by protocol privileged roles.
Only a strategy can call this function.
When the strategy ends, this function saves returns and rewards, and marks the strategy as finalized.
Only a strategy can call this function.
This function allocates garden capital to a strategy.
Only the garden or a strategy can call this function.
The function pays gas costs back to the keeper from executing transactions including any past debt.
Only governance or team multi-sig can call this function.
This function can mark a garden as verified.
Only the protocol Keeper can call this function.
This function allows the user to deposit into a garden by using signature-based gas-less transactions (meta-tx).
Only the protocol Keeper can call this function.
This function allows the user to withdraw from a garden by using signature based gas-less transaction (meta-tx).
Only the protocol Keeper can call this function.
This function allows the user to claim their rewards of a garden by using signature based gas-less transaction (meta-tx).
Only the protocol Keeper can call this function.
This function allows the user to claim their rewards of a garden and stake all BABL rewards into the Heart Garden by using signature based gas-less transaction (meta-tx).
Only a garden can call this function.
This function allows a garden to stake user BABL rewards on behalf of the user into the Heart Garden by using signature based gas-less transaction (meta-tx) as well as EIP-1271.
The following functions can be called by anyone without a transaction to retrieve information from the garden.
Function to check if the garden is private (true) or public (false).
Function to check if all garden members have strategist role (true means that all garden members have strategist role).
Function to check if all garden members have voting privileges (true means all garden members can vote).
Function to retrieve the controller smart-contract address.
Function to retrieve the garden original creator address.
Function to check whether or not the strategy belongs to the garden (true or false).
Function to retrieve contributor information.
Function to get the address of the garden reserveAsset.
Function to get whether or not governance has verified the garden and the category.
Function to get the timestamp that overrides the depositLock
with a global hard lock.
Function to get the delay required (in seconds) before a garden member can mint a garden NFT since its initial deposit.
Function to get the total number of contributors in the garden.
Function to get the timestamp of the garden creation.
Function to get the minimum contribution amount required by the garden.
Function to get the minimum required delay (in seconds) between a deposit and a withdrawal (i.e. 1 second to avoid flashloans).
Function to get the minimum liquidity required for an asset to be tradable by this garden.
Function to get the minimum strategy duration (in seconds).
Function to get the maximum strategy duration (in seconds).
Function to get the number of profits denominated in the reserve asset that are set aside (reserved) for strategies and voters. LP profit rewards are auto-compounded.
Function to get the garden absolute returns value.
Function to get the total stake from strategists in all the strategies.
Function to get the minimum quorum (1e18 = 100%) needed to approve and execute a strategy.
Function to get the minimum voters to approve and execute a strategy.
function to get the maximum deposit limit of a garden.
Function to get how long the strategy will wait in seconds to execute after being approved.
Function to get an array of current strategies.
Function to get the address of an extra creator within the array of extraCreators. As param, it needs the index from 0 to 3 as there is a maximum of 4 extra creators.
Function to get an array of all finalized strategies.
Function to check all active strategies in the garden.
Function to get current debt to be paid to the Keeper.
Function to get the total fees paid to Keeper.
Function to get the last recorded price per share of the garden during deposit or withdrawal operation.
Function to get the last recorded time of the deposit or withdraw in seconds.
Function to get the decay rate of the slippage for pricePerShare over time.
Function to get the base slippage for pricePerShare of the garden.
Function to get the name of the garden token.
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
uint256 _amountIn
Amount of the reserve asset to deposit by the contributor
uint256 _minAmountOut
Min amount of Garden shares to receive by contributor
address _to
Address to mint Garden shares to
address _referrer
The user that referred the deposit
uint256 _amountIn
Quantity of the garden token to withdraw
uint256 _minAmountOut
Min quantity of reserve asset to receive
address payable _to
Address to send component assets to
bool _withPenalty
Whether or not this is a withdrawal that triggers a liquidation
address _unwindStrategy
Strategy to unwind if any. Zero address otherwise
address[] calldata _finalizedStrategies
Array of finalized strategies to claim rewards from
uint256 _minAmountOut
Min quantity of Heart Garden tokens (hBABL) to receive
address[] calldata _finalizedStrategies
Array of finalized strategies to claim and stake rewards from
address _newCreator
New creator address
uint8 _index
Index of the extra creator in the array of 4 extra-creators (if any)
address[4] memory _newCreators
Addresses of the new extra creators
uint256 _hardlockStartsAt
New global hardlock starts at timestamp.
address _newCreator
New creator address
address[4] memory _newCreators
Addresses of the new extra creators
bool _publicStrategist
Whether or not all garden members will get be able to suggest strategies
bool _publicStewards
Whether or not all garden members will be able to vote on proposals
address _token
Address of BABL or any other ERC20Comp related governance token
address _delegatee
Address to delegate token voting power into
uint256[12] memory _newParams
New params. See below.
string memory _name
Name of the strategy
string memory _symbol
Symbol of the strategy
uint256[] calldata _stratParams
Num params for the strategy
uint8[] callData _opTypes
Type for every operation in the strategy
address[] calldata _opIntegrations
Integrations to pass for each operation in order. One per operation.
bytes calldata _opEncodedDatas
64 bytes of operations metadata per operation (size of 64 * numOps)
uint256 _rewards
Amount of Reserve Asset profits to set aside for strategist and stewards roles (if any)
int256 _returns
Strategy returns. It can include profits or losses.
uint256 _burningAmount
The amount of strategist stake to burn in case of strategy losses.
uint256 _capital
Amount of capital to allocate to the strategy.
address payable _keeper
Keeper that executed the transaction
uint256 _fee
The fee paid to keeper to compensate the gas cost
uint256 _verifiedCategory
1 for verified gardens, 0 otherwise. Additional categories will use different numbering in the future.
uint256 _amountIn
Amount of the reserve asset that is received from contributor.
uint256 _minAmountOut
Min amount of Garden shares to receive by contributor.
uint256 _nonce
Current nonce to prevent replay attacks.
uint256 _maxFee
Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount unless it is subsidized totally or partially by the garden or treasury. Fee is expressed in reserve asset.
uint256 _to
Address to mint shares to.
uint256 _pricePerShare
Price per share of the garden calculated off-chain by Keeper.
uint256 _fee
Actual fee keeper demands. Have to be less than _maxFee.
address _signer
The user to who signed the signature.
address _referrer
The user that referred the deposit.
bytes memory _signature
Signature by the user to verify deposit params
uint256 _amountIn
Quantity of the garden tokens to withdraw.
uint256 _minAmountOut
Min quantity of reserve asset to receive.
uint256 _nonce
Current nonce to prevent replay attacks.
uint256 _maxFee
Max fee user is willing to pay keeper. Fee is substracted from the withdrawn amount. Fee is expressed in reserve asset.
bool _withPenalty
Whether or not this is an immediate withdrawal.
address _unwindStrategy
Strategy to unwind (if any)
uint256 _pricePerShare
Price per share of the garden calculated off-chain by Keeper.
uint256 _strategyNAV
NAV of the strategy to unwind
uint256 _fee
Actual fee keeper demands. Have to be less than _maxFee.
address _signer
The user to who signed the signature.
bytes memory _signature
Signature by the user to verify deposit params
uint256 _babl
BABL rewards from mining program.
uint256 _profits
Profit rewards in reserve asset.
uint256 _nonce
Current nonce to prevent replay attacks.
uint256 _maxFee
Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset.
uint256 _fee
Actual fee keeper demands. Have to be less than _maxFee.
address _signer
The user who signed the signature.
bytes memory _signature
Signature by the user to verify claim params.
uint256 _babl
BABL rewards from mining program.
uint256 _profits
Profit rewards in reserve asset.
uint256 _minAmountOut
Minimum hBABL as part of the Heart Garden BABL staking.
uint256 _nonce
Current nonce of user in the claiming garden at to prevent replay attacks.
uint256 _nonceHeart
Current nonce of user in Heart Garden to prevent replay attacks.
uint256 _maxFee
Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset.
uint256 _fee
Actual fee keeper demands. Have to be less than _maxFee.
uint256 _pricePerShare
Price per share of Heart Garden.
address _signer
The user who signed the signature.
bytes memory _signature
Signature by the user to verify claim and stake params.
uint256 _amountIn
Amount of BABL that is going to be staked by contributor
uint256 _profits
Profit rewards in reserve asset.
uint256 _minAmountOut
Minimum hBABL as part of the Heart Garden BABL staking.
uint256 _nonce
Current nonce of user in the claiming garden at to prevent replay attacks.
uint256 _nonceHeart
Current nonce in heart garden to prevent replay attacks.
uint256 _maxFee
Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset.
address _to
Address to mint shares to.
uint256 _pricePerShare
Price per share of the garden calculated off-chain by Keeper.
address _signer
The garden who signed the stake operation using EIP-1271.
bytes memory _signature
Signature by the user to verify claim and stake params.
address _contributor
Garden member address
uint256 lastDepositAt
Timestamp of the last deposit
uint256 initialDepositAt
Timestamp of the initial deposit
uint256 claimedAt
Timestamp of the last claim
uint256 claimedBABL
Total amount of claimed BABL
uint256 claimedRewards
Total amount of claimed rewards
uint256 withdrawnSince
Total amount of withdrawals
uint256 totalDeposits
Total amount of deposits
uint256 nonce
Contributor nonce to avoid replay attacks
uint256 lockedBalance
Locked balance of the contributor