Skip to main content

BaseERC4626StrategyFactory

Git Source

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

NameTypeDescription
_targetVaultaddressERC4626 vault address to deposit into
_assetaddressUnderlying asset address (must match vault's asset)
_namestringStrategy share token name
_symbolstringStrategy share token symbol
_managementaddressManagement address (can update params)
_keeperaddressKeeper address (calls report)
_emergencyAdminaddressEmergency admin address
_donationAddressaddressDragon router address (receives profit shares)
_enableBurningboolTrue to enable burning shares during loss protection
_tokenizedStrategyAddressaddressTokenizedStrategy implementation address

Returns

NameTypeDescription
strategyAddressaddressDeployed strategy address

_getCreationCode

Returns the creation code for the strategy contract

function _getCreationCode() internal pure virtual returns (bytes memory);

Returns

NameTypeDescription
<none>bytesThe 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

NameTypeDescription
_vaultaddressVault address (e.g., Yearn vault, or factory constant for hardcoded vaults)
_assetaddressUnderlying asset address (or factory constant for hardcoded assets)
_namestringStrategy share token name
_symbolstringStrategy share token symbol
_managementaddressManagement address
_keeperaddressKeeper address
_emergencyAdminaddressEmergency admin address
_donationAddressaddressDonation address
_enableBurningboolEnable burning flag
_tokenizedStrategyAddressaddressTokenizedStrategy implementation
_deployeraddressAddress that will deploy the strategy

Returns

NameTypeDescription
<none>addressPredicted strategy address

_createStrategyInternal

Internal function to deploy strategy with given parameters

function _createStrategyInternal(CreateStrategyParams memory params) internal returns (address strategyAddress);

Parameters

NameTypeDescription
paramsCreateStrategyParamsStrategy creation parameters

Returns

NameTypeDescription
strategyAddressaddressDeployed 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

NameTypeDescription
deployeraddressTransaction sender performing deployment
targetVaultaddressERC4626 vault address the strategy will deposit into
donationAddressaddressDonation destination address for strategy
strategyAddressaddressDeployed strategy address
vaultTokenNamestringVault 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;
}