@@ -16,20 +16,28 @@ import { IERC4626 } from "../interfaces/IERC4626.sol";
1616/// only, and is not intended to, and does not, have any
1717/// particular legal or regulatory significance.
1818contract ERC4626HyperdriveFactory is HyperdriveFactory {
19+ /// @dev The address of the ERC4626 pool used in this factory.
1920 IERC4626 internal immutable pool;
2021
21- /// @notice Deploys the contract
22+ /// @notice The sweep targets used in deployed instances. This specifies
23+ /// the addresses that the fee collector can sweep to collect
24+ /// incentives and redistribute them.
25+ address [] internal _sweepTargets;
26+
27+ /// @notice Initializes the factory.
2228 /// @param _factoryConfig The variables that configure the factory;
23- /// @param _deployer The contract which holds the bytecode and deploys new versions .
24- /// @param _linkerFactory The address of the linker factory.
29+ /// @param _deployer The contract that deploys new hyperdrive instances .
30+ /// @param _linkerFactory The linker factory.
2531 /// @param _linkerCodeHash The hash of the linker contract's constructor code.
26- /// @param _pool The Maker ERC4626 manger contract address
32+ /// @param _pool The ERC4626 pool.
33+ /// @param _sweepTargets_ The addresses that can be swept by the fee collector.
2734 constructor (
2835 FactoryConfig memory _factoryConfig ,
2936 IHyperdriveDeployer _deployer ,
3037 address _linkerFactory ,
3138 bytes32 _linkerCodeHash ,
32- IERC4626 _pool
39+ IERC4626 _pool ,
40+ address [] memory _sweepTargets_
3341 )
3442 HyperdriveFactory (
3543 _factoryConfig,
@@ -38,7 +46,48 @@ contract ERC4626HyperdriveFactory is HyperdriveFactory {
3846 _linkerCodeHash
3947 )
4048 {
49+ // Initialize the ERC4626 pool.
4150 pool = _pool;
51+
52+ // Initialize the default sweep targets.
53+ _sweepTargets = _sweepTargets_;
54+ }
55+
56+ /// @notice Allows governance to change the sweep targets used in deployed
57+ /// instances.
58+ /// @param _sweepTargets_ The new sweep targets.
59+ function updateSweepTargets (
60+ address [] calldata _sweepTargets_
61+ ) external onlyGovernance {
62+ _sweepTargets = _sweepTargets_;
63+ }
64+
65+ /// @notice This deploys and initializes a new ERC4626Hyperdrive instance.
66+ /// @param _config The pool configuration.
67+ /// @param _contribution The contribution amount.
68+ /// @param _apr The initial spot rate.
69+ function deployAndInitialize (
70+ IHyperdrive.PoolConfig memory _config ,
71+ bytes32 [] memory ,
72+ uint256 _contribution ,
73+ uint256 _apr
74+ ) public payable override returns (IHyperdrive) {
75+ // Deploy and initialize the ERC4626 hyperdrive instance with the
76+ // default sweep targets provided as extra data.
77+ address [] memory sweepTargets_ = _sweepTargets;
78+ bytes32 [] memory extraData;
79+ assembly ("memory-safe" ) {
80+ extraData := sweepTargets_
81+ }
82+ IHyperdrive hyperdrive = super .deployAndInitialize (
83+ _config,
84+ extraData,
85+ _contribution,
86+ _apr
87+ );
88+
89+ // Return the hyperdrive instance.
90+ return hyperdrive;
4291 }
4392
4493 /// @notice This deploys a data provider for the ERC4626 hyperdrive instance
@@ -62,4 +111,10 @@ contract ERC4626HyperdriveFactory is HyperdriveFactory {
62111 )
63112 );
64113 }
114+
115+ /// @notice Gets the sweep targets.
116+ /// @return The sweep targets.
117+ function getSweepTargets () external view returns (address [] memory ) {
118+ return _sweepTargets;
119+ }
65120}
0 commit comments