Skip to main content

LidoStrategyFactory

Git Source

Inherits: BaseStrategyFactory

Title: LidoStrategyFactory

Author: Golem Foundation

Factory for deploying LidoStrategy instances with deterministic addresses

Uses CREATE2 for predictable deployment addresses based on parameters \n * DEPLOYMENT:\n * - Hardcoded to wstETH on Ethereum mainnet\n * - Parameters hashed to prevent duplicate deployments\n * - Each deployer can create multiple strategies with different params\n * \n * GAS COST:\n * - Strategy deployment: ~3-4M gas\n * - Includes full contract deployment (not a proxy)\n

Note: security-contact: [email protected]

State Variables

WSTETH

wstETH token address on Ethereum mainnet

Lido's wrapped staked ETH (non-rebasing wrapper for stETH)

address public constant WSTETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0

Functions

createStrategy

Deploys a new LidoStrategy instance

Uses CREATE2 for deterministic deployment PARAMETERS HASHED FOR SALT: All parameters combined determine unique address Same parameters = same address (prevents duplicates) PROCESS:

  1. Hash all parameters for salt generation
  2. Encode bytecode with constructor args
  3. Deploy via CREATE2 (reverts if duplicate)
  4. Emit StrategyDeploy event
  5. Record deployment for tracking
function createStrategy(
string memory _name,
string memory _symbol,
address _management,
address _keeper,
address _emergencyAdmin,
address _donationAddress,
bool _enableBurning,
address _tokenizedStrategyAddress
) external returns (address strategyAddress);

Parameters

NameTypeDescription
_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 dragon loss protection
_tokenizedStrategyAddressaddressTokenizedStrategy implementation address

Returns

NameTypeDescription
strategyAddressaddressDeployed LidoStrategy address

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

Events

StrategyDeploy

Emitted when a new LidoStrategy is deployed

event StrategyDeploy(
address indexed deployer,
address indexed donationAddress,
address indexed strategyAddress,
string vaultTokenName
);

Parameters

NameTypeDescription
deployeraddressAddress that deployed the strategy
donationAddressaddressDragon router address that receives profit shares
strategyAddressaddressDeployed strategy address
vaultTokenNamestringStrategy share token name