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.
Parameter | Description |
---|---|
| Amount of the reserve asset to deposit by the contributor |
| Min amount of Garden shares to receive by contributor |
| Address to mint Garden shares to |
| 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.
Parameter | Description |
---|---|
| Quantity of the garden token to withdraw |
| Min quantity of reserve asset to receive |
| Address to send component assets to |
| Whether or not this is a withdrawal that triggers a liquidation |
| 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.
Parameter | Description |
---|---|
| 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.
Parameter | Description |
---|---|
| Min quantity of Heart Garden tokens (hBABL) to receive |
| 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.
Parameter | Description |
---|---|
| New creator address |
| 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).
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
| 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)).
Parameter | Description |
---|---|
| New creator address |
| 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.
Parameter | Description |
---|---|
| Whether or not all garden members will get be able to suggest strategies |
| 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.
Parameter | Description |
---|---|
| Address of BABL or any other ERC20Comp related governance token |
| Address to delegate token voting power into |
UpdateGardenParams
Only a garden creator can call this function.
The function updates relevant garden params.
Parameter | Description |
---|---|
| 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.
Parameter | Description |
---|---|
| Name of the strategy |
| Symbol of the strategy |
| Num params for the strategy |
| Type for every operation in the strategy |
| Integrations to pass for each operation in order. One per operation. |
| 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.
Parameter | Description |
---|---|
| Amount of Reserve Asset profits to set aside for strategist and stewards roles (if any) |
| Strategy returns. It can include profits or losses. |
| 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.
Parameter | Description |
---|---|
| 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.
Parameter | Description |
---|---|
| Keeper that executed the transaction |
| 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.
Parameter | Description |
---|---|
| 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).
Parameter | Description |
---|---|
| Amount of the reserve asset that is received from contributor. |
| Min amount of Garden shares to receive by contributor. |
| Current nonce to prevent replay attacks. |
| 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. |
| Address to mint shares to. |
| Price per share of the garden calculated off-chain by Keeper. |
| Actual fee keeper demands. Have to be less than _maxFee. |
| The user to who signed the signature. |
| The user that referred the deposit. |
| 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).
Parameter | Description |
---|---|
| Quantity of the garden tokens to withdraw. |
| Min quantity of reserve asset to receive. |
| Current nonce to prevent replay attacks. |
| Max fee user is willing to pay keeper. Fee is substracted from the withdrawn amount. Fee is expressed in reserve asset. |
| Whether or not this is an immediate withdrawal. |
| Strategy to unwind (if any) |
| Price per share of the garden calculated off-chain by Keeper. |
| NAV of the strategy to unwind |
| Actual fee keeper demands. Have to be less than _maxFee. |
| The user to who signed the 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).
Parameter | Description |
---|---|
| BABL rewards from mining program. |
| Profit rewards in reserve asset. |
| Current nonce to prevent replay attacks. |
| Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset. |
| Actual fee keeper demands. Have to be less than _maxFee. |
| The user who signed the 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).
Parameter | Description |
---|---|
| BABL rewards from mining program. |
| Profit rewards in reserve asset. |
| Minimum hBABL as part of the Heart Garden BABL staking. |
| Current nonce of user in the claiming garden at to prevent replay attacks. |
| Current nonce of user in Heart Garden to prevent replay attacks. |
| Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset. |
| Actual fee keeper demands. Have to be less than _maxFee. |
| Price per share of Heart Garden. |
| The user who signed the 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.
Parameter | Description |
---|---|
| Amount of BABL that is going to be staked by contributor |
| Profit rewards in reserve asset. |
| Minimum hBABL as part of the Heart Garden BABL staking. |
| Current nonce of user in the claiming garden at to prevent replay attacks. |
| Current nonce in heart garden to prevent replay attacks. |
| 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 mint shares to. |
| Price per share of the garden calculated off-chain by Keeper. |
| The garden who signed the stake operation using EIP-1271. |
| 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.
Parameter | Description |
---|---|
| Garden member address |
| Timestamp of the last deposit |
| Timestamp of the initial deposit |
| Timestamp of the last claim |
| Total amount of claimed BABL |
| Total amount of claimed rewards |
| Total amount of withdrawals |
| Total amount of deposits |
| Contributor nonce to avoid replay attacks |
| 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