Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions contracts/src/deployers/HyperdriveDeployerCoordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ abstract contract HyperdriveDeployerCoordinator is
config.initialVaultSharePrice = deployment.initialSharePrice;

// Deploy the Hyperdrive instance and add it to the deployment struct.
bytes32 deploymentId = _deploymentId; // Avoid stack too deep error
bytes32 salt = _salt; // Avoid stack too deep error
address hyperdrive = IHyperdriveCoreDeployer(coreDeployer).deploy(
config,
_extraData,
Expand All @@ -153,7 +155,9 @@ abstract contract HyperdriveDeployerCoordinator is
deployment.target2,
deployment.target3,
deployment.target4,
_salt
// NOTE: We hash the sender and deployment ID with the salt to
// prevent the front-running of deployments.
keccak256(abi.encode(msg.sender, deploymentId, salt))
);
_deployments[msg.sender][_deploymentId].hyperdrive = hyperdrive;

Expand Down Expand Up @@ -209,7 +213,9 @@ abstract contract HyperdriveDeployerCoordinator is
target = IHyperdriveTargetDeployer(target0Deployer).deploy(
config_,
_extraData,
_salt
// NOTE: We hash the sender and deployment ID with the salt to
// prevent the front-running of deployments.
keccak256(abi.encode(msg.sender, _deploymentId, _salt))
);

// Store the deployment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ contract ERC4626HyperdriveCoreDeployer is IHyperdriveCoreDeployer {
address vault = abi.decode(_extraData, (address));
return (
address(
new ERC4626Hyperdrive{ salt: _salt }(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new ERC4626Hyperdrive{
salt: keccak256(abi.encode(msg.sender, _salt))
}(
_config,
_target0,
_target1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ contract ERC4626Target0Deployer is IHyperdriveTargetDeployer {
bytes32 _salt
) external returns (address) {
IERC4626 vault = IERC4626(abi.decode(_extraData, (address)));
return address(new ERC4626Target0{ salt: _salt }(_config, vault));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new ERC4626Target0{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, vault)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ contract ERC4626Target1Deployer is IHyperdriveTargetDeployer {
bytes32 _salt
) external returns (address) {
IERC4626 vault = IERC4626(abi.decode(_extraData, (address)));
return address(new ERC4626Target1{ salt: _salt }(_config, vault));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new ERC4626Target1{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, vault)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ contract ERC4626Target2Deployer is IHyperdriveTargetDeployer {
bytes32 _salt
) external returns (address) {
IERC4626 vault = IERC4626(abi.decode(_extraData, (address)));
return address(new ERC4626Target2{ salt: _salt }(_config, vault));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new ERC4626Target2{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, vault)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ contract ERC4626Target3Deployer is IHyperdriveTargetDeployer {
bytes32 _salt
) external returns (address) {
IERC4626 vault = IERC4626(abi.decode(_extraData, (address)));
return address(new ERC4626Target3{ salt: _salt }(_config, vault));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new ERC4626Target3{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, vault)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ contract ERC4626Target4Deployer is IHyperdriveTargetDeployer {
bytes32 _salt
) external returns (address) {
IERC4626 vault = IERC4626(abi.decode(_extraData, (address)));
return address(new ERC4626Target4{ salt: _salt }(_config, vault));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new ERC4626Target4{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, vault)
);
}
}
14 changes: 5 additions & 9 deletions contracts/src/deployers/steth/StETHHyperdriveCoreDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,11 @@ contract StETHHyperdriveCoreDeployer is IHyperdriveCoreDeployer {
) external returns (address) {
return (
address(
new StETHHyperdrive{ salt: _salt }(
_config,
target0,
target1,
target2,
target3,
target4,
lido
)
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new StETHHyperdrive{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, target0, target1, target2, target3, target4, lido)
)
);
}
Expand Down
9 changes: 8 additions & 1 deletion contracts/src/deployers/steth/StETHTarget0Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ contract StETHTarget0Deployer is IHyperdriveTargetDeployer {
bytes memory, // unused extra data
bytes32 _salt
) external override returns (address) {
return address(new StETHTarget0{ salt: _salt }(_config, lido));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new StETHTarget0{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, lido)
);
}
}
9 changes: 8 additions & 1 deletion contracts/src/deployers/steth/StETHTarget1Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ contract StETHTarget1Deployer is IHyperdriveTargetDeployer {
bytes memory, // unused extra data
bytes32 _salt
) external returns (address) {
return address(new StETHTarget1{ salt: _salt }(_config, lido));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new StETHTarget1{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, lido)
);
}
}
9 changes: 8 additions & 1 deletion contracts/src/deployers/steth/StETHTarget2Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ contract StETHTarget2Deployer is IHyperdriveTargetDeployer {
bytes memory, // unused extra data
bytes32 _salt
) external returns (address) {
return address(new StETHTarget2{ salt: _salt }(_config, lido));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new StETHTarget2{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, lido)
);
}
}
9 changes: 8 additions & 1 deletion contracts/src/deployers/steth/StETHTarget3Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ contract StETHTarget3Deployer is IHyperdriveTargetDeployer {
bytes memory, // unused extra data
bytes32 _salt
) external returns (address) {
return address(new StETHTarget3{ salt: _salt }(_config, lido));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new StETHTarget3{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, lido)
);
}
}
9 changes: 8 additions & 1 deletion contracts/src/deployers/steth/StETHTarget4Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ contract StETHTarget4Deployer is IHyperdriveTargetDeployer {
bytes memory, // unused extra data
bytes32 _salt
) external returns (address) {
return address(new StETHTarget4{ salt: _salt }(_config, lido));
return
address(
// NOTE: We hash the sender with the salt to prevent the
// front-running of deployments.
new StETHTarget4{
salt: keccak256(abi.encode(msg.sender, _salt))
}(_config, lido)
);
}
}