Skip to content

Commit b1b9196

Browse files
committed
Wired up the boilerplate contracts
1 parent 6994293 commit b1b9196

27 files changed

+318
-102
lines changed

codegen/templates/deployers/HyperdriveCoreDeployer.sol.jinja

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
pragma solidity 0.8.22;
33

44
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
5+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
56
import { IHyperdriveCoreDeployer } from "../../interfaces/IHyperdriveCoreDeployer.sol";
67
import { {{ name.capitalized }}Hyperdrive } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Hyperdrive.sol";
78

@@ -15,6 +16,8 @@ contract {{ name.capitalized }}HyperdriveCoreDeployer is IHyperdriveCoreDeployer
1516
/// @notice Deploys a Hyperdrive instance with the given parameters.
1617
/// @param __name The name of the Hyperdrive pool.
1718
/// @param _config The configuration of the Hyperdrive pool.
19+
/// @param _adminController The admin controller that will specify the
20+
/// admin parameters for this instance.
1821
/// @param _target0 The target0 address.
1922
/// @param _target1 The target1 address.
2023
/// @param _target2 The target2 address.
@@ -25,6 +28,7 @@ contract {{ name.capitalized }}HyperdriveCoreDeployer is IHyperdriveCoreDeployer
2528
function deployHyperdrive(
2629
string memory __name,
2730
IHyperdrive.PoolConfig memory _config,
31+
IHyperdriveAdminController _adminController,
2832
bytes memory, // unused _extraData,
2933
address _target0,
3034
address _target1,
@@ -42,6 +46,7 @@ contract {{ name.capitalized }}HyperdriveCoreDeployer is IHyperdriveCoreDeployer
4246
}(
4347
__name,
4448
_config,
49+
_adminController,
4550
_target0,
4651
_target1,
4752
_target2,

codegen/templates/deployers/HyperdriveDeployerCoordinator.sol.jinja

+11-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.22;
33

44
import { ERC20 } from "openzeppelin/token/ERC20/ERC20.sol";
55
import { SafeERC20 } from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
6+
import { {{ name.capitalized }}Conversions } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Conversions.sol";
67
import { I{{ name.capitalized }} } from "../../interfaces/I{{ name.capitalized }}.sol";
78
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
89
import { I{{ name.capitalized }}Hyperdrive } from "../../interfaces/I{{ name.capitalized }}Hyperdrive.sol";
@@ -141,7 +142,7 @@ contract {{ name.capitalized }}HyperdriveDeployerCoordinator is HyperdriveDeploy
141142
function convertToBase(
142143
uint256 _shareAmount
143144
) public view returns (uint256) {
144-
// FIXME
145+
return {{ name.capitalized }}Conversions.convertToBase(_shareAmount);
145146
}
146147

147148
/// @notice Convert an amount of base to an amount of vault shares.
@@ -150,7 +151,7 @@ contract {{ name.capitalized }}HyperdriveDeployerCoordinator is HyperdriveDeploy
150151
function convertToShares(
151152
uint256 _baseAmount
152153
) public view returns (uint256) {
153-
// FIXME
154+
return {{ name.capitalized }}Conversions.convertToShares(_baseAmount);
154155
}
155156

156157
{% if contract.payable %}
@@ -167,23 +168,27 @@ contract {{ name.capitalized }}HyperdriveDeployerCoordinator is HyperdriveDeploy
167168
}
168169
{% endif %}
169170

171+
// FIXME: Update the extra data comment if the extra data isn't empty.
172+
//
170173
/// @notice Checks the pool configuration to ensure that it is valid.
171174
/// @param _deployConfig The deploy configuration of the Hyperdrive pool.
175+
/// @param _extraData The empty extra data.
172176
function _checkPoolConfig(
173-
IHyperdrive.PoolDeployConfig memory _deployConfig
177+
IHyperdrive.PoolDeployConfig memory _deployConfig,
178+
bytes memory _extraData
174179
) internal view override {
175180
// Perform the default checks.
176-
super._checkPoolConfig(_deployConfig);
181+
super._checkPoolConfig(_deployConfig, _extraData);
177182

178183
// ****************************************************************
179184
// FIXME: Implement this for new instances.
180185
// Ensure that the vault shares token address is properly configured.
181-
if (address(_deployConfig.vaultSharesToken) != address(VAULT_SHARES_TOKEN) {
186+
if (address(_deployConfig.vaultSharesToken) != address(0)) {
182187
revert IHyperdriveDeployerCoordinator.InvalidVaultSharesToken();
183188
}
184189

185190
// Ensure that the base token address is properly configured.
186-
if (address(_deployConfig.baseToken) == address(0)) {
191+
if (address(_deployConfig.baseToken) != address(0)) {
187192
revert IHyperdriveDeployerCoordinator.InvalidBaseToken();
188193
}
189194
// *****************************************************************

codegen/templates/deployers/Target0Deployer.sol.jinja

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.22;
44
import { {{ name.capitalized }}Target0 } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Target0.sol";
55
import { I{{ name.capitalized }} } from "../../interfaces/I{{ name.capitalized }}.sol";
66
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
7+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
78
import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDeployer.sol";
89

910
/// @author DELV
@@ -15,10 +16,13 @@ import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDep
1516
contract {{ name.capitalized }}Target0Deployer is IHyperdriveTargetDeployer {
1617
/// @notice Deploys a target0 instance with the given parameters.
1718
/// @param _config The configuration of the Hyperdrive pool.
19+
/// @param _adminController The admin controller that will specify the
20+
/// admin parameters for this instance.
1821
/// @param _salt The create2 salt used in the deployment.
1922
/// @return The address of the newly deployed {{ name.capitalized }}Target0 instance.
2023
function deployTarget(
2124
IHyperdrive.PoolConfig memory _config,
25+
IHyperdriveAdminController _adminController,
2226
bytes memory, // unused _extraData
2327
bytes32 _salt
2428
) external returns (address) {
@@ -28,7 +32,7 @@ contract {{ name.capitalized }}Target0Deployer is IHyperdriveTargetDeployer {
2832
// front-running of deployments.
2933
new {{ name.capitalized }}Target0{
3034
salt: keccak256(abi.encode(msg.sender, _salt))
31-
}(_config)
35+
}(_config, _adminController)
3236
);
3337
}
3438
}

codegen/templates/deployers/Target1Deployer.sol.jinja

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.22;
44
import { {{ name.capitalized }}Target1 } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Target1.sol";
55
import { I{{ name.capitalized }} } from "../../interfaces/I{{ name.capitalized }}.sol";
66
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
7+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
78
import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDeployer.sol";
89

910
/// @author DELV
@@ -15,10 +16,13 @@ import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDep
1516
contract {{ name.capitalized }}Target1Deployer is IHyperdriveTargetDeployer {
1617
/// @notice Deploys a target1 instance with the given parameters.
1718
/// @param _config The configuration of the Hyperdrive pool.
19+
/// @param _adminController The admin controller that will specify the
20+
/// admin parameters for this instance.
1821
/// @param _salt The create2 salt used in the deployment.
1922
/// @return The address of the newly deployed {{ name.capitalized }}Target1 instance.
2023
function deployTarget(
2124
IHyperdrive.PoolConfig memory _config,
25+
IHyperdriveAdminController _adminController,
2226
bytes memory, // unused _extraData
2327
bytes32 _salt
2428
) external returns (address) {
@@ -28,7 +32,7 @@ contract {{ name.capitalized }}Target1Deployer is IHyperdriveTargetDeployer {
2832
// front-running of deployments.
2933
new {{ name.capitalized }}Target1{
3034
salt: keccak256(abi.encode(msg.sender, _salt))
31-
}(_config)
35+
}(_config, _adminController)
3236
);
3337
}
3438
}

codegen/templates/deployers/Target2Deployer.sol.jinja

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.22;
44
import { {{ name.capitalized }}Target2 } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Target2.sol";
55
import { I{{ name.capitalized }} } from "../../interfaces/I{{ name.capitalized }}.sol";
66
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
7+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
78
import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDeployer.sol";
89

910
/// @author DELV
@@ -15,10 +16,13 @@ import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDep
1516
contract {{ name.capitalized }}Target2Deployer is IHyperdriveTargetDeployer {
1617
/// @notice Deploys a target2 instance with the given parameters.
1718
/// @param _config The configuration of the Hyperdrive pool.
19+
/// @param _adminController The admin controller that will specify the
20+
/// admin parameters for this instance.
1821
/// @param _salt The create2 salt used in the deployment.
1922
/// @return The address of the newly deployed {{ name.capitalized }}Target2 instance.
2023
function deployTarget(
2124
IHyperdrive.PoolConfig memory _config,
25+
IHyperdriveAdminController _adminController,
2226
bytes memory, // unused _extraData
2327
bytes32 _salt
2428
) external returns (address) {
@@ -28,7 +32,7 @@ contract {{ name.capitalized }}Target2Deployer is IHyperdriveTargetDeployer {
2832
// front-running of deployments.
2933
new {{ name.capitalized }}Target2{
3034
salt: keccak256(abi.encode(msg.sender, _salt))
31-
}(_config)
35+
}(_config, _adminController)
3236
);
3337
}
3438
}

codegen/templates/deployers/Target3Deployer.sol.jinja

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.22;
44
import { {{ name.capitalized }}Target3 } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Target3.sol";
55
import { I{{ name.capitalized }} } from "../../interfaces/I{{ name.capitalized }}.sol";
66
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
7+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
78
import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDeployer.sol";
89

910
/// @author DELV
@@ -15,10 +16,13 @@ import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDep
1516
contract {{ name.capitalized }}Target3Deployer is IHyperdriveTargetDeployer {
1617
/// @notice Deploys a target3 instance with the given parameters.
1718
/// @param _config The configuration of the Hyperdrive pool.
19+
/// @param _adminController The admin controller that will specify the
20+
/// admin parameters for this instance.
1821
/// @param _salt The create2 salt used in the deployment.
1922
/// @return The address of the newly deployed {{ name.capitalized }}Target3 instance.
2023
function deployTarget(
2124
IHyperdrive.PoolConfig memory _config,
25+
IHyperdriveAdminController _adminController,
2226
bytes memory, // unused _extraData
2327
bytes32 _salt
2428
) external returns (address) {
@@ -28,7 +32,7 @@ contract {{ name.capitalized }}Target3Deployer is IHyperdriveTargetDeployer {
2832
// front-running of deployments.
2933
new {{ name.capitalized }}Target3{
3034
salt: keccak256(abi.encode(msg.sender, _salt))
31-
}(_config)
35+
}(_config, _adminController)
3236
);
3337
}
3438
}

codegen/templates/deployers/Target4Deployer.sol.jinja

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity 0.8.22;
44
import { {{ name.capitalized }}Target4 } from "../../instances/{{ name.lowercase }}/{{ name.capitalized }}Target4.sol";
55
import { I{{ name.capitalized }} } from "../../interfaces/I{{ name.capitalized }}.sol";
66
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
7+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
78
import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDeployer.sol";
89

910
/// @author DELV
@@ -15,10 +16,13 @@ import { IHyperdriveTargetDeployer } from "../../interfaces/IHyperdriveTargetDep
1516
contract {{ name.capitalized }}Target4Deployer is IHyperdriveTargetDeployer {
1617
/// @notice Deploys a target4 instance with the given parameters.
1718
/// @param _config The configuration of the Hyperdrive pool.
19+
/// @param _adminController The admin controller that will specify the
20+
/// admin parameters for this instance.
1821
/// @param _salt The create2 salt used in the deployment.
1922
/// @return The address of the newly deployed {{ name.capitalized }}Target4 instance.
2023
function deployTarget(
2124
IHyperdrive.PoolConfig memory _config,
25+
IHyperdriveAdminController _adminController,
2226
bytes memory, // unused _extraData
2327
bytes32 _salt
2428
) external returns (address) {
@@ -28,7 +32,7 @@ contract {{ name.capitalized }}Target4Deployer is IHyperdriveTargetDeployer {
2832
// front-running of deployments.
2933
new {{ name.capitalized }}Target4{
3034
salt: keccak256(abi.encode(msg.sender, _salt))
31-
}(_config)
35+
}(_config, _adminController)
3236
);
3337
}
3438
}

codegen/templates/instances/Hyperdrive.sol.jinja

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { SafeERC20 } from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
66
import { Hyperdrive } from "../../external/Hyperdrive.sol";
77
import { IERC20 } from "../../interfaces/IERC20.sol";
88
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
9+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
910
import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
1011

1112
/// ______ __ _________ _____
@@ -60,6 +61,8 @@ contract {{ name.capitalized }}Hyperdrive is Hyperdrive, {{ name.capitalized }}B
6061
/// @notice Instantiates Hyperdrive with a {{ name.capitalized }} vault as the yield source.
6162
/// @param __name The pool's name.
6263
/// @param _config The configuration of the Hyperdrive pool.
64+
/// @param __adminController The admin controller that will specify the
65+
/// admin parameters for this instance.
6366
/// @param _target0 The target0 address.
6467
/// @param _target1 The target1 address.
6568
/// @param _target2 The target2 address.
@@ -68,6 +71,7 @@ contract {{ name.capitalized }}Hyperdrive is Hyperdrive, {{ name.capitalized }}B
6871
constructor(
6972
string memory __name,
7073
IHyperdrive.PoolConfig memory _config,
74+
IHyperdriveAdminController __adminController,
7175
address _target0,
7276
address _target1,
7377
address _target2,
@@ -77,6 +81,7 @@ contract {{ name.capitalized }}Hyperdrive is Hyperdrive, {{ name.capitalized }}B
7781
Hyperdrive(
7882
__name,
7983
_config,
84+
__adminController,
8085
_target0,
8186
_target1,
8287
_target2,

codegen/templates/instances/Target0.sol.jinja

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.22;
33

44
import { HyperdriveTarget0 } from "../../external/HyperdriveTarget0.sol";
55
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
6+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
67
import { {{ name.uppercase }}_HYPERDRIVE_KIND } from "../../libraries/Constants.sol";
78
import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
89

@@ -17,9 +18,12 @@ import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
1718
contract {{ name.capitalized }}Target0 is HyperdriveTarget0, {{ name.capitalized }}Base {
1819
/// @notice Initializes the target0 contract.
1920
/// @param _config The configuration of the Hyperdrive pool.
21+
/// @param __adminController The admin controller that will specify the
22+
/// admin parameters for this instance.
2023
constructor(
21-
IHyperdrive.PoolConfig memory _config
22-
) HyperdriveTarget0(_config) {}
24+
IHyperdrive.PoolConfig memory _config,
25+
IHyperdriveAdminController __adminController
26+
) HyperdriveTarget0(_config, __adminController) {}
2327

2428
/// @notice Returns the instance's kind.
2529
/// @return The instance's kind.

codegen/templates/instances/Target1.sol.jinja

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.22;
33

44
import { HyperdriveTarget1 } from "../../external/HyperdriveTarget1.sol";
55
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
6+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
67
import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
78

89
/// @author DELV
@@ -16,7 +17,10 @@ import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
1617
contract {{ name.capitalized }}Target1 is HyperdriveTarget1, {{ name.capitalized }}Base {
1718
/// @notice Initializes the target1 contract.
1819
/// @param _config The configuration of the Hyperdrive pool.
20+
/// @param __adminController The admin controller that will specify the
21+
/// admin parameters for this instance.
1922
constructor(
20-
IHyperdrive.PoolConfig memory _config
21-
) HyperdriveTarget1(_config) {}
23+
IHyperdrive.PoolConfig memory _config,
24+
IHyperdriveAdminController __adminController
25+
) HyperdriveTarget1(_config, __adminController) {}
2226
}

codegen/templates/instances/Target2.sol.jinja

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.22;
33

44
import { HyperdriveTarget2 } from "../../external/HyperdriveTarget2.sol";
55
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
6+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
67
import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
78

89
/// @author DELV
@@ -16,7 +17,10 @@ import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
1617
contract {{ name.capitalized }}Target2 is HyperdriveTarget2, {{ name.capitalized }}Base {
1718
/// @notice Initializes the target2 contract.
1819
/// @param _config The configuration of the Hyperdrive pool.
20+
/// @param __adminController The admin controller that will specify the
21+
/// admin parameters for this instance.
1922
constructor(
20-
IHyperdrive.PoolConfig memory _config
21-
) HyperdriveTarget2(_config) {}
23+
IHyperdrive.PoolConfig memory _config,
24+
IHyperdriveAdminController __adminController
25+
) HyperdriveTarget2(_config, __adminController) {}
2226
}

codegen/templates/instances/Target3.sol.jinja

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.22;
33

44
import { HyperdriveTarget3 } from "../../external/HyperdriveTarget3.sol";
55
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
6+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
67
import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
78

89
/// @author DELV
@@ -16,7 +17,10 @@ import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
1617
contract {{ name.capitalized }}Target3 is HyperdriveTarget3, {{ name.capitalized }}Base {
1718
/// @notice Initializes the target3 contract.
1819
/// @param _config The configuration of the Hyperdrive pool.
20+
/// @param __adminController The admin controller that will specify the
21+
/// admin parameters for this instance.
1922
constructor(
20-
IHyperdrive.PoolConfig memory _config
21-
) HyperdriveTarget3(_config) {}
23+
IHyperdrive.PoolConfig memory _config,
24+
IHyperdriveAdminController __adminController
25+
) HyperdriveTarget3(_config, __adminController) {}
2226
}

codegen/templates/instances/Target4.sol.jinja

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma solidity 0.8.22;
33

44
import { HyperdriveTarget4 } from "../../external/HyperdriveTarget4.sol";
55
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
6+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
67
import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
78

89
/// @author DELV
@@ -16,7 +17,10 @@ import { {{ name.capitalized }}Base } from "./{{ name.capitalized }}Base.sol";
1617
contract {{ name.capitalized }}Target4 is HyperdriveTarget4, {{ name.capitalized }}Base {
1718
/// @notice Initializes the target4 contract.
1819
/// @param _config The configuration of the Hyperdrive pool.
20+
/// @param __adminController The admin controller that will specify the
21+
/// admin parameters for this instance.
1922
constructor(
20-
IHyperdrive.PoolConfig memory _config
21-
) HyperdriveTarget4(_config) {}
23+
IHyperdrive.PoolConfig memory _config,
24+
IHyperdriveAdminController __adminController
25+
) HyperdriveTarget4(_config, __adminController) {}
2226
}

0 commit comments

Comments
 (0)