The following functions can be called by any user or public roles.
Sweep
Public: Anyone can call this function.
This function converts any token sent to the strategy into the reserve asset and sends it to the garden.
function sweep(address _token, uint256 _newSlippage) external;
The strategy must be inactive
Parameter
Description
UpdateParams
Only the Strategist can call this function
This function updates specific strategy parameters.
function updateParams(uint256[5] calldata _params) external;
Parameter
Description
Definition of strategy parameters:
* _params[0] duration Strategy duration in seconds
* _params[1] maxGasFeePercentage Max gas fee % capped to 10e16
* _params[2] maxTradeSlippagePercentage Max trading slippage % capped to 20e16
* _params[3] maxAllocationPercentage Max garden capital allocation % (<= 1e18)
* _params[4] maxCapitalRequested Max capital requested in reserveAsset
New duration value must be equal or less than the original duration.
DeleteCandidateStrategy
Only the Strategist can call this function
This function deletes a candidate strategy.
function deleteCandidateStrategy() external;
Privileged Functions
The following functions can only be executed by protocol privileged roles.
ResolveVoting
Only the protocol Keeper can call this function
This function adds off-chain gas-less voting results on-chain.
This function executes a strategy that has been activated and gone through the cooldown period.
function executeStrategy(uint256 _capital, uint256 _fee) external;
FinalizeStrategy
Only the protocol Keeper can call this function
This function exits from an executed strategy. Returns balance back to the garden and sets the capital aside for withdrawals in ETH. Pays the keeper and updates the reserve asset position accordingly.
Function that calculates the price using the oracle and executes a trade. Must call the exchange to get the price and pass minReceiveQuantity accordingly.
Helper to invoke Approve on ERC20 from integrations in the strategy context.
function invokeApprove(
address _spender,
address _asset,
uint256 _quantity
) external;
View functions
The following functions can be called by anyone without a transaction to retrieve information from the strategy.
GetNAV
Function to get the strategy Net Asset Value (NAV) in reserveAsset.
function getNAV() external view returns (uint256);
OpEncodedData
Function to get encoded operation data (in bytes) where each consecutive 64 bytes are reserved for each operation metadata. Metadata is usually including operation addresses and values needed for those operations.
function opEncodedData() external view returns (bytes memory);
GetOperationsCount
Function to get the number of operations used by the strategy.
function getOperationsCount() external view returns (uint256);
data[0] Timestamp of when the strategy was executed (executedAt)
data[1] Timestamp of when the strategy was finalized (exitedAt)
data[2] Timestamp of when the strategy was updated (updatedAt)
data[3] Timestamp of when the strategy was created (enteredAt)
data[4] Amount of total positive votes for the strategy
data[5] Amount of total positive votes against the strategy
data[6] Capital allocated to the strategy
data[7] Capital returned by the strategy
data[8] Expected capital returned (considers expected return)
data[9] Strategy Rewards
data[10] Profit amount (if any)
data[11] Amount difference between real return and expected capital returned
data[12] Garden token supply when the strategy was created
data[13] Garden token supply when the strategy was finalized
data[14] Proportional slippage factor vs. total duration
boolData[0] Profits (true) losses (false)
boolData[1] If profits where above expectations (true) or below (false)
IsStrategyActive
Function to check whether or not the strategy is active.
function isStrategyActive() external view returns (bool);
GetUserVotes
Function to get specific user votes for a user.
function getUserVotes(address _address) external view returns (int256);
Strategist
Function to get the strategist address.
function strategist() external view returns (address);
EnteredAt
Function to get the timestamp when the strategy was created.
function enteredAt() external view returns (uint256);
EnteredCooldownAt
Function to get the timestamp when the strategy reached quorum.
Other view functions are the following:
Stake
Function to get the stake of the strategist in the strategy.
function stake() external view returns (uint256);
StrategyRewards
Function to get the assigned strategyRewards from BABL Mining program for the strategy.
function strategyRewards() external view returns (uint256);
MaxCapitalRequested
Function to get the max capital requested for the strategy in reserveAsset.
function maxCapitalRequested() external view returns (uint256);
MaxAllocationPercentage
Function to get the maximum capital allocation percentage (%).
function maxAllocationPercentage() external view returns (uint256);
MaxTradeSlippagePercentage
Function to get the maximum trading slippage in % with 18 decimals precision.
function maxTradeSlippagePercentage() external view returns (uint256);
MaxGasFeePercentage
Function to get the maximum gas fee percentage to limit the execution cost for the strategy-keeper.
function maxGasFeePercentage() external view returns (uint256);
ExpectedReturn
Function to get the expected return or expected profits in % with 18 decimals precision (i.e. 5% 5e16)
function expectedReturn() external view returns (uint256);
Duration
Function to get the duration of the strategy (in seconds).
function duration() external view returns (uint256);
TotalPositiveVotes
Function to get the total positive votes of the strategy.
function totalPositiveVotes() external view returns (uint256);
TotalNegativeVotes
Function to get the total negative votes of the strategy.
function totalNegativeVotes() external view returns (uint256);
CapitalReturned
Function to get the capital returned in reserveAsset.
function capitalReturned() external view returns (uint256);
CapitalAllocated
Function to get the capital allocated in reserveAsset.
function capitalAllocated() external view returns (uint256);
Garden
Function to get the garden address the strategy belongs to.
function garden() external view returns (IGarden);