Skip to content

Commit 5099fb0

Browse files
authored
Merge branch 'main' into sxDai_tests
2 parents 38d54c9 + fbfa3fe commit 5099fb0

File tree

61 files changed

+2648
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2648
-169
lines changed

.github/workflows/benchmark.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
2121
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
2222
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
23+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
2324
steps:
2425
# Install the dependencies.
2526
- uses: actions/checkout@v2

.github/workflows/coverage.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
2121
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
2222
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
23+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
2324
steps:
2425
- uses: actions/checkout@v3
2526
with:
@@ -40,7 +41,7 @@ jobs:
4041
- name: Install Foundry
4142
uses: foundry-rs/foundry-toolchain@v1
4243
with:
43-
version: nightly
44+
version: nightly-626221f5ef44b4af950a08e09bd714650d9eb77d
4445
cache: false
4546

4647
- name: forge version

.github/workflows/solidity_lint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
2121
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
2222
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
23+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
2324
steps:
2425
- uses: actions/checkout@v3
2526
with:

.github/workflows/solidity_test.yml

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
2121
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
2222
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
23+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
2324
steps:
2425
- uses: actions/checkout@v3
2526
with:
@@ -43,6 +44,7 @@ jobs:
4344
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
4445
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
4546
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
47+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
4648
steps:
4749
- uses: actions/checkout@v3
4850
with:
@@ -66,6 +68,7 @@ jobs:
6668
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
6769
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
6870
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
71+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
6972
steps:
7073
- uses: actions/checkout@v3
7174
with:
@@ -89,6 +92,7 @@ jobs:
8992
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
9093
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
9194
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
95+
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
9296
steps:
9397
- uses: actions/checkout@v3
9498
with:

cSpell.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"IEIP",
1616
"IERC",
1717
"IWETH",
18+
"linea",
19+
"Linea",
20+
"LINEA",
1821
"LUSD",
1922
"Mintable",
2023
"Multicall",

codegen/hyperdrive_codegen/templates.py

+3
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ class FileInfo:
4141
TemplatePathInfo("deployers/Target1Deployer.sol.jinja", "Target1Deployer", "deployers"),
4242
TemplatePathInfo("deployers/Target2Deployer.sol.jinja", "Target2Deployer", "deployers"),
4343
TemplatePathInfo("deployers/Target3Deployer.sol.jinja", "Target3Deployer", "deployers"),
44+
TemplatePathInfo("deployers/Target4Deployer.sol.jinja", "Target4Deployer", "deployers"),
4445
]
4546

4647
instance_templates = [
4748
TemplatePathInfo("instances/Base.sol.jinja", "Base", "instances"),
49+
TemplatePathInfo("instances/Conversions.sol.jinja", "Conversions", "instances"),
4850
TemplatePathInfo("instances/Hyperdrive.sol.jinja", "Hyperdrive", "instances"),
4951
TemplatePathInfo("instances/Target0.sol.jinja", "Target0", "instances"),
5052
TemplatePathInfo("instances/Target1.sol.jinja", "Target1", "instances"),
5153
TemplatePathInfo("instances/Target2.sol.jinja", "Target2", "instances"),
5254
TemplatePathInfo("instances/Target3.sol.jinja", "Target3", "instances"),
55+
TemplatePathInfo("instances/Target4.sol.jinja", "Target4", "instances"),
5356
]
5457

5558
interface_templates = [

codegen/templates/deployers/HyperdriveDeployerCoordinator.sol.jinja

+19-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,24 @@ contract {{ name.capitalized }}HyperdriveDeployerCoordinator is HyperdriveDeploy
135135
return value;
136136
}
137137

138+
/// @notice Convert an amount of vault shares to an amount of base.
139+
/// @param _shareAmount The vault shares amount.
140+
/// @return The base amount.
141+
function convertToBase(
142+
uint256 _shareAmount
143+
) public view returns (uint256) {
144+
// FIXME
145+
}
146+
147+
/// @notice Convert an amount of base to an amount of vault shares.
148+
/// @param _baseAmount The base amount.
149+
/// @return The vault shares amount.
150+
function convertToShares(
151+
uint256 _baseAmount
152+
) public view returns (uint256) {
153+
// FIXME
154+
}
155+
138156
{% if contract.payable %}
139157
/// @dev We override the message value check since this integration is
140158
/// payable.
@@ -194,7 +212,7 @@ contract {{ name.capitalized }}HyperdriveDeployerCoordinator is HyperdriveDeploy
194212
) internal pure override returns (uint256) {
195213
// ****************************************************************
196214
// FIXME: Implement this for new instances.
197-
return ONE;
215+
return convertToBase(ONE);
198216
// ****************************************************************
199217
}
200218
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.22;
3+
4+
/// @author DELV
5+
/// @title {{ name.capitalized }}Conversions
6+
/// @notice The conversion logic for the {{ name.capitalized }} Hyperdrive integration.
7+
/// @custom:disclaimer The language used in this code is for coding convenience
8+
/// only, and is not intended to, and does not, have any
9+
/// particular legal or regulatory significance.
10+
library {{ name.capitalized }}Conversions {
11+
/// @dev Convert an amount of vault shares to an amount of base.
12+
/// @param _shareAmount The vault shares amount.
13+
/// @return The base amount.
14+
function convertToBase(
15+
uint256 _shareAmount
16+
) external view returns (uint256) {
17+
// FIXME
18+
}
19+
20+
/// @dev Convert an amount of base to an amount of vault shares.
21+
/// @param _baseAmount The base amount.
22+
/// @return The vault shares amount.
23+
function convertToShares(
24+
uint256 _baseAmount
25+
) external view returns (uint256) {
26+
// FIXME
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.22;
3+
4+
import { IHyperdrive } from "../../interfaces/IHyperdrive.sol";
5+
import { IHyperdriveAdminController } from "../../interfaces/IHyperdriveAdminController.sol";
6+
import { IHyperdriveCoreDeployer } from "../../interfaces/IHyperdriveCoreDeployer.sol";
7+
import { IXRenzoDeposit } from "../../interfaces/IXRenzoDeposit.sol";
8+
import { EzETHLineaHyperdrive } from "../../instances/ezeth-linea/EzETHLineaHyperdrive.sol";
9+
10+
/// @author DELV
11+
/// @title EzETHLineaHyperdriveCoreDeployer
12+
/// @notice The core deployer for the EzETHLineaHyperdrive implementation.
13+
/// @custom:disclaimer The language used in this code is for coding convenience
14+
/// only, and is not intended to, and does not, have any
15+
/// particular legal or regulatory significance.
16+
contract EzETHLineaHyperdriveCoreDeployer is IHyperdriveCoreDeployer {
17+
/// @notice The Renzo deposit contract on Linea. The latest mint rate is
18+
/// used as the vault share price.
19+
IXRenzoDeposit public immutable xRenzoDeposit;
20+
21+
/// @notice Instantiates the ezETH Linea Hyperdrive base contract.
22+
/// @param _xRenzoDeposit The xRenzoDeposit contract that provides the
23+
/// vault share price.
24+
constructor(IXRenzoDeposit _xRenzoDeposit) {
25+
xRenzoDeposit = _xRenzoDeposit;
26+
}
27+
28+
/// @notice Deploys a Hyperdrive instance with the given parameters.
29+
/// @param __name The name of the Hyperdrive pool.
30+
/// @param _config The configuration of the Hyperdrive pool.
31+
/// @param _adminController The admin controller that will specify the
32+
/// admin parameters for this instance.
33+
/// @param _target0 The target0 address.
34+
/// @param _target1 The target1 address.
35+
/// @param _target2 The target2 address.
36+
/// @param _target3 The target3 address.
37+
/// @param _target4 The target4 address.
38+
/// @param _salt The create2 salt used in the deployment.
39+
/// @return The address of the newly deployed EzETHLineaHyperdrive instance.
40+
function deployHyperdrive(
41+
string memory __name,
42+
IHyperdrive.PoolConfig memory _config,
43+
IHyperdriveAdminController _adminController,
44+
bytes memory, // unused _extraData,
45+
address _target0,
46+
address _target1,
47+
address _target2,
48+
address _target3,
49+
address _target4,
50+
bytes32 _salt
51+
) external returns (address) {
52+
return (
53+
address(
54+
// NOTE: We hash the sender with the salt to prevent the
55+
// front-running of deployments.
56+
new EzETHLineaHyperdrive{
57+
salt: keccak256(abi.encode(msg.sender, _salt))
58+
}(
59+
__name,
60+
_config,
61+
_adminController,
62+
_target0,
63+
_target1,
64+
_target2,
65+
_target3,
66+
_target4,
67+
xRenzoDeposit
68+
)
69+
)
70+
);
71+
}
72+
}

0 commit comments

Comments
 (0)