Skip to content

Commit

Permalink
update hyperdrive to v1.0.16 and project to 0.17.0 (#183)
Browse files Browse the repository at this point in the history
# Resolved Issues
#181
  • Loading branch information
dpaiton authored Aug 1, 2024
1 parent 4503a93 commit e4fcc39
Show file tree
Hide file tree
Showing 51 changed files with 8,396 additions and 1,022 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ members = [

[workspace.package]
name = "hyperdrive-rs"
version = "0.16.10"
version = "0.17.0"
authors = [
"Alex Towle <[email protected]>",
"Dylan Paiton <[email protected]>",
Expand All @@ -29,9 +29,9 @@ repository = "https://github.com/delvtech/hyperdrive-rs"
description = "API for simulating Hyperdrive smart contract transactions."

[workspace.dependencies]
fixedpointmath = { version = "0.16.10", path="crates/fixedpointmath" }
hyperdrive-wrappers = { version = "0.16.10", path="crates/hyperdrive-wrappers" }
hyperdrive-math = { version = "0.16.10", path="crates/hyperdrive-math" }
fixedpointmath = { version = "0.17.0", path="crates/fixedpointmath" }
hyperdrive-wrappers = { version = "0.17.0", path="crates/hyperdrive-wrappers" }
hyperdrive-math = { version = "0.17.0", path="crates/hyperdrive-math" }

[workspace.lints.clippy]
comparison_chain = "allow"
Expand Down
2 changes: 1 addition & 1 deletion bindings/hyperdrivepy/src/hyperdrive_state_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl HyperdriveState {
let scaled_maturity_time_fp =
FixedPoint::from(U256::from_dec_str(scaled_maturity_time).map_err(|err| {
PyErr::new::<PyValueError, _>(format!(
"Failed to convert scaled_amturity_time string {} to FixedPoint: {}",
"Failed to convert scaled_maturity_time string {} to FixedPoint: {}",
scaled_maturity_time, err
))
})?);
Expand Down
8 changes: 4 additions & 4 deletions crates/hyperdrive-math/src/long/close.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ethers::types::{I256, U256};
use ethers::types::U256;
use eyre::{eyre, Result};
use fixedpointmath::{fixed, int256, FixedPoint};
use fixedpointmath::{fixed, FixedPoint};

use crate::{State, YieldSpace};

Expand Down Expand Up @@ -103,8 +103,8 @@ impl State {

#[cfg(test)]
mod tests {
use std::panic;

use ethers::types::I256;
use fixedpointmath::int256;
use hyperdrive_test_utils::{chain::TestChain, constants::FAST_FUZZ_RUNS};
use rand::{thread_rng, Rng};

Expand Down
11 changes: 11 additions & 0 deletions crates/hyperdrive-test-utils/src/bin/testnet_deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use hyperdrive_wrappers::wrappers::{
steth_target1_deployer::{StETHTarget1Deployer, StETHTarget1DeployerLibs},
steth_target2_deployer::{StETHTarget2Deployer, StETHTarget2DeployerLibs},
steth_target3_deployer::{StETHTarget3Deployer, StETHTarget3DeployerLibs},
steth_target4_deployer::{StETHTarget4Deployer, StETHTarget4DeployerLibs},
};
use test_utils::chain::{Chain, ChainClient};

Expand Down Expand Up @@ -289,6 +290,15 @@ async fn testnet_deployment(
)?
.send()
.await?;
let target4 = StETHTarget4Deployer::link_and_deploy(
client.clone(),
(),
StETHTarget4DeployerLibs {
lp_math: lp_math.address(),
},
)?
.send()
.await?;
StETHHyperdriveDeployerCoordinator::deploy(
client.clone(),
(
Expand All @@ -298,6 +308,7 @@ async fn testnet_deployment(
target1.address(),
target2.address(),
target3.address(),
target4.address(),
lido.address(),
),
)?
Expand Down
59 changes: 59 additions & 0 deletions crates/hyperdrive-test-utils/src/chain/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use hyperdrive_wrappers::wrappers::{
erc4626_target2_deployer::{ERC4626Target2Deployer, ERC4626Target2DeployerLibs},
erc4626_target3::{ERC4626Target3, ERC4626Target3Libs},
erc4626_target3_deployer::{ERC4626Target3Deployer, ERC4626Target3DeployerLibs},
erc4626_target4::{ERC4626Target4, ERC4626Target4Libs},
erc4626_target4_deployer::{ERC4626Target4Deployer, ERC4626Target4DeployerLibs},
hyperdrive_factory::{
self, FactoryConfig, Fees as FactoryFees, HyperdriveFactory, HyperdriveFactoryEvents,
Options, PoolDeployConfig,
Expand All @@ -39,6 +41,7 @@ use hyperdrive_wrappers::wrappers::{
steth_target1_deployer::{StETHTarget1Deployer, StETHTarget1DeployerLibs},
steth_target2_deployer::{StETHTarget2Deployer, StETHTarget2DeployerLibs},
steth_target3_deployer::{StETHTarget3Deployer, StETHTarget3DeployerLibs},
steth_target4_deployer::{StETHTarget4Deployer, StETHTarget4DeployerLibs},
};
use serde::{Deserialize, Deserializer, Serialize};
use test_utils::{chain::Chain, constants::ETH};
Expand Down Expand Up @@ -385,6 +388,15 @@ impl TestnetDeploy for Chain {
)?
.send()
.await?;
let target4 = ERC4626Target4::link_and_deploy(
client.clone(),
(config.clone(),),
ERC4626Target4Libs {
lp_math: lp_math.address(),
},
)?
.send()
.await?;
let erc4626_hyperdrive = ERC4626Hyperdrive::deploy(
client.clone(),
(
Expand All @@ -394,6 +406,7 @@ impl TestnetDeploy for Chain {
target1.address(),
target2.address(),
target3.address(),
target4.address(),
),
)?
.send()
Expand Down Expand Up @@ -586,6 +599,15 @@ impl TestnetDeploy for Chain {
)?
.send()
.await?;
let target4 = ERC4626Target4Deployer::link_and_deploy(
client.clone(),
(),
ERC4626Target4DeployerLibs {
lp_math: lp_math.address(),
},
)?
.send()
.await?;
ERC4626HyperdriveDeployerCoordinator::deploy(
client.clone(),
(
Expand All @@ -596,6 +618,7 @@ impl TestnetDeploy for Chain {
target1.address(),
target2.address(),
target3.address(),
target4.address(),
),
)?
.send()
Expand Down Expand Up @@ -691,6 +714,19 @@ impl TestnetDeploy for Chain {
)
.send()
.await?;
factory
.deploy_target(
[0x01; 32],
erc4626_deployer_coordinator.address(),
pool_config.clone(),
Vec::new().into(),
config.erc4626_hyperdrive_fixed_apr,
config.erc4626_hyperdrive_time_stretch_apr,
U256::from(4),
[0x01; 32],
)
.send()
.await?;
let tx = factory
.deploy_and_initialize(
[0x01; 32],
Expand Down Expand Up @@ -769,6 +805,15 @@ impl TestnetDeploy for Chain {
)?
.send()
.await?;
let target4 = StETHTarget4Deployer::link_and_deploy(
client.clone(),
(),
StETHTarget4DeployerLibs {
lp_math: lp_math.address(),
},
)?
.send()
.await?;
StETHHyperdriveDeployerCoordinator::deploy(
client.clone(),
(
Expand All @@ -779,6 +824,7 @@ impl TestnetDeploy for Chain {
target1.address(),
target2.address(),
target3.address(),
target4.address(),
lido.address(),
),
)?
Expand Down Expand Up @@ -868,6 +914,19 @@ impl TestnetDeploy for Chain {
)
.send()
.await?;
factory
.deploy_target(
[0x02; 32],
steth_deployer_coordinator.address(),
pool_config.clone(),
Vec::new().into(),
config.steth_hyperdrive_fixed_apr,
config.steth_hyperdrive_time_stretch_apr,
U256::from(4),
[0x02; 32],
)
.send()
.await?;
let tx = factory
.deploy_and_initialize(
[0x02; 32],
Expand Down
14 changes: 14 additions & 0 deletions crates/hyperdrive-test-utils/src/chain/etch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use hyperdrive_wrappers::wrappers::{
erc4626_target1::{ERC4626Target1, ERC4626Target1Libs},
erc4626_target2::{ERC4626Target2, ERC4626Target2Libs},
erc4626_target3::{ERC4626Target3, ERC4626Target3Libs},
erc4626_target4::{ERC4626Target4, ERC4626Target4Libs},
etching_vault::EtchingVault,
ihyperdrive::IHyperdrive,
lp_math::LPMath,
Expand All @@ -38,6 +39,7 @@ impl TestChain {
let target1_address = hyperdrive.target_1().call().await?;
let target2_address = hyperdrive.target_2().call().await?;
let target3_address = hyperdrive.target_3().call().await?;
let target4_address = hyperdrive.target_4().call().await?;
let vault_address = hyperdrive.vault_shares_token().call().await?;

// Deploy templates for each of the contracts that should be etched and
Expand Down Expand Up @@ -133,6 +135,18 @@ impl TestChain {
.await?;
pairs.push((target3_address, target3_template.address()));

// Deploy the target4 template.
let target4_template = ERC4626Target4::link_and_deploy(
client.clone(),
(config.clone(), vault_address),
ERC4626Target4Libs {
lp_math: lp_math.address(),
},
)?
.send()
.await?;
pairs.push((target4_address, target4_template.address()));

// Etch the "etching vault" onto the current vault contract. The
// etching vault implements `convertToAssets` to return the immutable
// that was passed on deployment. This is necessary because the
Expand Down
2 changes: 1 addition & 1 deletion crates/hyperdrive-wrappers/hyperdrive.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.14
v1.0.16

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/hyperdrive-wrappers/src/wrappers/erc20_mintable.rs

Large diffs are not rendered by default.

84 changes: 82 additions & 2 deletions crates/hyperdrive-wrappers/src/wrappers/erc4626_hyperdrive.rs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit e4fcc39

Please sign in to comment.