BaseERC4626StrategyFactory
Inherits: BaseStrategyFactory
Title: BaseERC4626StrategyFactory
Author: Golem Foundation
Abstract base factory for ERC4626-based yield donating strategies
Uses CREATE2 for deterministic deployments; records deployments via BaseStrategyFactory This factory provides shared logic for deploying strategies that deposit into ERC4626 vaults. Child factories must implement _getCreationCode() to provide the specific strategy bytecode.
Note: security-contact: [email protected]
Functions
createStrategy
Deploy a new ERC4626-based strategy
Deterministic salt derived from all parameters to avoid duplicates
function createStrategy(
address _targetVault,
address _asset,
string memory _name,
string memory _symbol,
address _management,
address _keeper,
address _emergencyAdmin,
address _donationAddress,
bool _enableBurning,
address _tokenizedStrategyAddress
) external returns (address strategyAddress);
Parameters
| Name | Type | Description |
|---|---|---|
_targetVault | address | ERC4626 vault address to deposit into |
_asset | address | Underlying asset address (must match vault's asset) |
_name | string | Strategy share token name |
_symbol | string | Strategy share token symbol |
_management | address | Management address (can update params) |
_keeper | address | Keeper address (calls report) |
_emergencyAdmin | address | Emergency admin address |
_donationAddress | address | Dragon router address (receives profit shares) |
_enableBurning | bool | True to enable burning shares during loss protection |
_tokenizedStrategyAddress | address | TokenizedStrategy implementation address |
Returns
| Name | Type | Description |
|---|---|---|
strategyAddress | address | Deployed strategy address |
_getCreationCode
Returns the creation code for the strategy contract
function _getCreationCode() internal pure virtual returns (bytes memory);
Returns
| Name | Type | Description |
|---|---|---|
<none> | bytes | The bytecode of the strategy contract (without constructor args) |
computeStrategyAddress
Compute the deterministic address where a strategy will be deployed
Must be implemented by child factories using their own bytecode
function computeStrategyAddress(
address _vault,
address _asset,
string memory _name,
string memory _symbol,
address _management,
address _keeper,
address _emergencyAdmin,
address _donationAddress,
bool _enableBurning,
address _tokenizedStrategyAddress,
address _deployer
) public view override returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
_vault | address | Vault address (e.g., Yearn vault, or factory constant for hardcoded vaults) |
_asset | address | Underlying asset address (or factory constant for hardcoded assets) |
_name | string | Strategy share token name |
_symbol | string | Strategy share token symbol |
_management | address | Management address |
_keeper | address | Keeper address |
_emergencyAdmin | address | Emergency admin address |
_donationAddress | address | Donation address |
_enableBurning | bool | Enable burning flag |
_tokenizedStrategyAddress | address | TokenizedStrategy implementation |
_deployer | address | Address that will deploy the strategy |
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | Predicted strategy address |
_createStrategyInternal
Internal function to deploy strategy with given parameters
function _createStrategyInternal(CreateStrategyParams memory params) internal returns (address strategyAddress);
Parameters
| Name | Type | Description |
|---|---|---|
params | CreateStrategyParams | Strategy creation parameters |
Returns
| Name | Type | Description |
|---|---|---|
strategyAddress | address | Deployed strategy address |
Events
StrategyDeploy
Emitted on successful strategy deployment
event StrategyDeploy(
address indexed deployer,
address indexed targetVault,
address indexed donationAddress,
address strategyAddress,
string vaultTokenName
);
Parameters
| Name | Type | Description |
|---|---|---|
deployer | address | Transaction sender performing deployment |
targetVault | address | ERC4626 vault address the strategy will deposit into |
donationAddress | address | Donation destination address for strategy |
strategyAddress | address | Deployed strategy address |
vaultTokenName | string | Vault token name associated with strategy |
Structs
CreateStrategyParams
Parameters for strategy creation
struct CreateStrategyParams {
address targetVault;
address asset;
string name;
string symbol;
address management;
address keeper;
address emergencyAdmin;
address donationAddress;
bool enableBurning;
address tokenizedStrategyAddress;
}