Garden
Interface: IGarden.sol
ERC-20 Functions
Gardens are fully composable (ERC-20). That means all the ERC-20 functions are available.
You can see all of them here.
Functions
The following functions can be called by public roles.
Deposit
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.
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
Withdraw
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.
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
ClaimReturns
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.
address[] calldata _finalizedStrategies
Array of finalized strategies to claim rewards from
It must include all finalized strategies since the last claim.
ClaimAndStakeReturns
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.
uint256 _minAmountOut
Min quantity of Heart Garden tokens (hBABL) to receive
address[] calldata _finalizedStrategies
Array of finalized strategies to claim and stake rewards from
ClaimNFT
Any garden member can call this function.
This function allows any garden member to claim a garden NFT.
MakeGardenPublic
Only a garden creator can call this function.
The function makes public a previously private garden.
TransferCreatorRights
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.
address _newCreator
New creator address
uint8 _index
Index of the extra creator in the array of 4 extra-creators (if any)
AddExtraCreators
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).
address[4] memory _newCreators
Addresses of the new extra creators
ResetHardlock
Only a garden creator can call this function.
This function allows the creator to reset the garden hardlock for all users.
uint256 _hardlockStartsAt
New global hardlock starts at timestamp.
UpdateCreators
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)).
address _newCreator
New creator address
address[4] memory _newCreators
Addresses of the new extra creators
SetPublicRights
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.
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
DelegateVotes
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.
address _token
Address of BABL or any other ERC20Comp related governance token
address _delegatee
Address to delegate token voting power into
UpdateGardenParams
Only a garden creator can call this function.
The function updates relevant garden params.
uint256[12] memory _newParams
New params. See below.
Definition of the garden parameters:
AddStrategy
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.
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)
Definition of the strategy parameters:
Definition of operation types (opTypes):
Integration addresses can be found in the deployments section.
ExpireCandidateStrategy
Only the strategist can call this function.
The function removes an expired candidate strategy from the strategy array.
Privileged Functions
The following functions can only be executed by protocol privileged roles.
FinalizeStrategy
Only a strategy can call this function.
When the strategy ends, this function saves returns and rewards, and marks the strategy as finalized.
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.
AllocateCapitalToStrategy
Only a strategy can call this function.
This function allocates garden capital to a strategy.
uint256 _capital
Amount of capital to allocate to the strategy.
PayKeeper
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.
address payable _keeper
Keeper that executed the transaction
uint256 _fee
The fee paid to keeper to compensate the gas cost
VerifyGarden
Only governance or team multi-sig can call this function.
This function can mark a garden as verified.
uint256 _verifiedCategory
1 for verified gardens, 0 otherwise. Additional categories will use different numbering in the future.
DepositBySig
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).
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
WithdrawBySig
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).
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
ClaimRewardsBySig
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).
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.
ClaimAndStakeRewardsBySig
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).
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.
StakeBySig
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.
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.
View Functions
The following functions can be called by anyone without a transaction to retrieve information from the garden.
PrivateGarden
Function to check if the garden is private (true) or public (false).
PublicStrategist
Function to check if all garden members have strategist role (true means that all garden members have strategist role).
PublicStewards
Function to check if all garden members have voting privileges (true means all garden members can vote).
Controller
Function to retrieve the controller smart-contract address.
Creator
Function to retrieve the garden original creator address.
IsGardenStrategy
Function to check whether or not the strategy belongs to the garden (true or false).
GetContributor
Function to retrieve contributor information.
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
ReserveAsset
Function to get the address of the garden reserveAsset.
VerifiedCategory
Function to get whether or not governance has verified the garden and the category.
HardlockStartsAt
Function to get the timestamp that overrides the depositLock
with a global hard lock.
CanMintNftAfter
Function to get the delay required (in seconds) before a garden member can mint a garden NFT since its initial deposit.
TotalContributors
Function to get the total number of contributors in the garden.
GardenInitializedAt
Function to get the timestamp of the garden creation.
MinContribution
Function to get the minimum contribution amount required by the garden.
DepositHardlock
Function to get the minimum required delay (in seconds) between a deposit and a withdrawal (i.e. 1 second to avoid flashloans).
MinLiquidityAsset
Function to get the minimum liquidity required for an asset to be tradable by this garden.
MinStrategyDuration
Function to get the minimum strategy duration (in seconds).
MaxStrategyDuration
Function to get the maximum strategy duration (in seconds).
ReserveAssetRewardsSetAside
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.
AbsoluteReturns
Function to get the garden absolute returns value.
TotalStake
Function to get the total stake from strategists in all the strategies.
MinVotesQuorum
Function to get the minimum quorum (1e18 = 100%) needed to approve and execute a strategy.
MinVoters
Function to get the minimum voters to approve and execute a strategy.
MaxDepositLimit
function to get the maximum deposit limit of a garden.
StrategyCooldownPeriod
Function to get how long the strategy will wait in seconds to execute after being approved.
GetStrategies
Function to get an array of current strategies.
ExtraCreators
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.
GetFinalizedStrategies
Function to get an array of all finalized strategies.
StrategyMapping
Function to check all active strategies in the garden.
KeeperDebt
Function to get current debt to be paid to the Keeper.
TotalKeeperFees
Function to get the total fees paid to Keeper.
LastPricePerShare
Function to get the last recorded price per share of the garden during deposit or withdrawal operation.
LastPricePerShareTS
Function to get the last recorded time of the deposit or withdraw in seconds.
PricePerShareDecayRate
Function to get the decay rate of the slippage for pricePerShare over time.
PricePerShareDelta
Function to get the base slippage for pricePerShare of the garden.
Name
Function to get the name of the garden token.
Last updated